mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-01 11:06:44 +01:00
implement screenshot taking
This commit is contained in:
parent
2a174898a8
commit
46c4ae08ed
1 changed files with 8 additions and 0 deletions
|
@ -466,6 +466,14 @@ int main(int argc, char **argv){
|
|||
}
|
||||
game.showconsole = true;
|
||||
PrintConsole(&game, "DEBUG: 512 frames skipped...");
|
||||
} else if ((game.debug) && (ev.type == ALLEGRO_EVENT_KEY_DOWN) && (ev.keyboard.keycode == ALLEGRO_KEY_F12)) {
|
||||
ALLEGRO_PATH *path = al_get_standard_path(ALLEGRO_USER_DOCUMENTS_PATH);
|
||||
char filename[255] = { };
|
||||
sprintf(filename, "SuperDerpy_%ld_%ld.png", time(NULL), clock());
|
||||
al_set_path_filename(path, filename);
|
||||
al_save_bitmap(al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP), al_get_backbuffer(game.display));
|
||||
PrintConsole(&game, "Screenshot stored in %s", al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP));
|
||||
al_destroy_path(path);
|
||||
}
|
||||
KEYDOWN_STATE(GAMESTATE_PAUSE, Pause)
|
||||
KEYDOWN_STATE(GAMESTATE_MENU, Menu)
|
||||
|
|
Loading…
Reference in a new issue