Allow saving of screenshots by pressing F12.
This commit is contained in:
parent
cccb0c88fc
commit
d0aa4879eb
|
@ -214,4 +214,9 @@ void saveScreenshot(void)
|
||||||
SDL_RenderReadPixels(app.renderer, NULL, SDL_PIXELFORMAT_ARGB8888, sshot->pixels, sshot->pitch);
|
SDL_RenderReadPixels(app.renderer, NULL, SDL_PIXELFORMAT_ARGB8888, sshot->pixels, sshot->pitch);
|
||||||
SDL_SaveBMP(sshot, filename);
|
SDL_SaveBMP(sshot, filename);
|
||||||
SDL_FreeSurface(sshot);
|
SDL_FreeSurface(sshot);
|
||||||
|
|
||||||
|
if (!dev.takeScreenshots)
|
||||||
|
{
|
||||||
|
printf("Saved '%s'\n", filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
11
src/main.c
11
src/main.c
|
@ -46,6 +46,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
initGameSystem();
|
initGameSystem();
|
||||||
|
|
||||||
|
createScreenshotFolder();
|
||||||
|
|
||||||
handleArguments(argc, argv);
|
handleArguments(argc, argv);
|
||||||
|
|
||||||
dev.fps = frames = td = 0;
|
dev.fps = frames = td = 0;
|
||||||
|
@ -133,6 +135,13 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (app.keyboard[SDL_SCANCODE_F12])
|
||||||
|
{
|
||||||
|
saveScreenshot();
|
||||||
|
|
||||||
|
app.keyboard[SDL_SCANCODE_F12] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (SDL_GetTicks() > expireTextTimer)
|
if (SDL_GetTicks() > expireTextTimer)
|
||||||
{
|
{
|
||||||
expireTexts(0);
|
expireTexts(0);
|
||||||
|
@ -169,8 +178,6 @@ static void handleArguments(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
dev.debug = 1;
|
dev.debug = 1;
|
||||||
|
|
||||||
createScreenshotFolder();
|
|
||||||
|
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue