This is for your game’s thumbnail on the dashboard, and if you have it on gd.games, it will also display a thumbnail there. If we don’t save it on our servers, you won’t see it on your other devices, so we save it.
This is done this way because many people didn’t have a thumbnail for their gd.games projects or on the dashboard, leading them to believe they had lost their games.
Having a visual is much more practical for everyone.
When does this happen? During preview or when pressing PrtScrn.
ive come to realize, kinda randomly, not when screenshotting. also i meant the built in screenshotting, not the operating system. Macs dont use print screen anyway
Wait the built-in screenshot when you’re in a preview or export? Let me try this myself.
Seems it happens when any scene is loaded. This only happens in previews (as shown in the code snippet from Gdevelop Codebase):
constructor(
renderer: gdjs.RuntimeGameRenderer,
captureOptions: CaptureOptions
) {
this._gameRenderer = renderer;
this._captureOptions = captureOptions;
}
/**
* To be called when the scene has started rendering.
*/
setupCaptureOptions(isPreview: boolean): void {
if (!isPreview || !this._captureOptions.screenshots) {
return;
}
for (const screenshotCaptureOption of this._captureOptions.screenshots) {
setTimeout(async () => {
await this.takeAndUploadScreenshot(screenshotCaptureOption.signedUrl);
}, screenshotCaptureOption.delayTimeInSeconds);
}
}
/**
* Take a screenshot and upload it to the server.
*/
async takeAndUploadScreenshot(signedUrl: string) {
const canvas = this._gameRenderer.getCanvas();
if (canvas) {
try {
const base64Data = canvas.toDataURL('image/png');
const blobData = base64ToBlob(base64Data);
await fetch(signedUrl, {
method: 'PUT',
body: blobData,
headers: {
'Content-Type': 'image/png',
},
});
} catch (error) {
console.error('Error while uploading screenshot:', error);
}
}
}
yes, i already found this code

