1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Merge pull request #256 from adrian17/screenshots

Save screenshots when PrintScreen is pressed
This commit is contained in:
Ted John
2014-08-04 07:30:28 +01:00
2 changed files with 11 additions and 1 deletions

View File

@@ -29,6 +29,7 @@
#include "config.h"
#include "gfx.h"
#include "osinterface.h"
#include "screenshot.h"
#include "window.h"
#include "rct2.h"
#include "cursors.h"
@@ -387,6 +388,12 @@ void osinterface_process_messages()
gKeysPressed[e.key.keysym.scancode] = 1;
if (e.key.keysym.sym == SDLK_RETURN && e.key.keysym.mod & KMOD_ALT)
osinterface_set_fullscreen_mode(!gGeneral_config.fullscreen_mode);
if (e.key.keysym.sym == SDLK_PRINTSCREEN){
RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, sint8) = 1;
//this function is normally called only in-game (in game_update)
//calling it here will save screenshots even while in main menu
screenshot_check();
}
break;
default:
break;

View File

@@ -259,7 +259,10 @@ int screenshot_dump_png()
unsigned int error = lodepng_encode(&png, &pngSize, dpi->bits, stride, dpi->height, &state);
if (!error) lodepng_save_file(png, pngSize, path);
if (error) fprintf(stderr, "error: %u: %s\n", error, lodepng_error_text(error));
if (error) {
fprintf(stderr, "error: %u: %s\n", error, lodepng_error_text(error));
index = -1;
}
free(png);
return index;