Allow saving of screenshots by pressing F12.

This commit is contained in:
Steve 2016-04-23 08:09:15 +01:00
parent cccb0c88fc
commit d0aa4879eb
2 changed files with 14 additions and 2 deletions

View File

@ -214,4 +214,9 @@ void saveScreenshot(void)
SDL_RenderReadPixels(app.renderer, NULL, SDL_PIXELFORMAT_ARGB8888, sshot->pixels, sshot->pitch);
SDL_SaveBMP(sshot, filename);
SDL_FreeSurface(sshot);
if (!dev.takeScreenshots)
{
printf("Saved '%s'\n", filename);
}
}

View File

@ -46,6 +46,8 @@ int main(int argc, char *argv[])
initGameSystem();
createScreenshotFolder();
handleArguments(argc, argv);
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)
{
expireTexts(0);
@ -169,8 +178,6 @@ static void handleArguments(int argc, char *argv[])
{
dev.debug = 1;
createScreenshotFolder();
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG);
}