From 2541ed0c66148a9e8b129b12f2da19b5bec1c7ae Mon Sep 17 00:00:00 2001 From: Mustafa Furkan Bulut Date: Mon, 15 Sep 2025 20:45:50 +0300 Subject: [PATCH] Don't overwrite old gifs --- src/rcore.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/rcore.c b/src/rcore.c index 735851c8e..3037fc08a 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1012,7 +1012,14 @@ void EndDrawing(void) Vector2 scale = GetWindowScaleDPI(); msf_gif_begin(&gifState, (int)((float)CORE.Window.render.width*scale.x), (int)((float)CORE.Window.render.height*scale.y)); - screenshotCounter++; + + for (int i = 0; i <= 999; i++) + { + if (!FileExists(TextFormat("%s/screenrec%03i.gif", CORE.Storage.basePath, screenshotCounter))) + break; + + screenshotCounter++; + } TRACELOG(LOG_INFO, "SYSTEM: Start animated GIF recording: %s", TextFormat("screenrec%03i.gif", screenshotCounter)); }