diff --git a/README.md b/README.md index 2080c70..09e632e 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Oh no, my os doesn't comme with minesweeper preinstalled, let's make it myself. - b : switch to beginner difficulty - i : switch to intermediate difficulty - e : switch to expert difficulty -- s : take a screenshot (not working everywhere, not sure why) +- s : take a screenshot # building diff --git a/main.c b/main.c index a1d11e2..6600fc5 100644 --- a/main.c +++ b/main.c @@ -271,10 +271,16 @@ int main(void) fill_game(); + int take_screenshot = 0; while (!WindowShouldClose()) { if (IsWindowResized()) screen_resize_handle(); + if (take_screenshot) { + TakeScreenshot("minesweeper-screenshot.png"); + take_screenshot = 0; + } + BeginDrawing(); { ClearBackground((Color) { @@ -282,15 +288,15 @@ int main(void) }); - if (IsKeyPressed(KEY_S)) { - TakeScreenshot("minesweeper-screenshot.png"); - } - if (IsKeyPressed(KEY_A)) { CloseWindow(); exit(0); } + if (IsKeyPressed(KEY_S)) { + take_screenshot = 1; + } + int resize = 0; if (IsKeyPressed(KEY_I)) { current_game_type = INTERMEDIATE; @@ -467,7 +473,7 @@ int main(void) if (collision(camera_coord, camera_texture, mouse_x, mouse_y)) { - TakeScreenshot("minesweeper-screenshot.png"); + take_screenshot = 1; } if (collision(diff_button[0], fixed_tile_texture, mouse_x, mouse_y))