fix screensho

This commit is contained in:
_N3m0 2024-03-13 15:01:40 +01:00
parent 6e9c653b7d
commit 1dd8470924
2 changed files with 12 additions and 6 deletions

View File

@ -13,7 +13,7 @@ Oh no, my os doesn't comme with minesweeper preinstalled, let's make it myself.
- b : switch to beginner difficulty - b : switch to beginner difficulty
- i : switch to intermediate difficulty - i : switch to intermediate difficulty
- e : switch to expert difficulty - e : switch to expert difficulty
- s : take a screenshot (not working everywhere, not sure why) - s : take a screenshot
# building # building

16
main.c
View File

@ -271,10 +271,16 @@ int main(void)
fill_game(); fill_game();
int take_screenshot = 0;
while (!WindowShouldClose()) { while (!WindowShouldClose()) {
if (IsWindowResized()) if (IsWindowResized())
screen_resize_handle(); screen_resize_handle();
if (take_screenshot) {
TakeScreenshot("minesweeper-screenshot.png");
take_screenshot = 0;
}
BeginDrawing(); BeginDrawing();
{ {
ClearBackground((Color) { ClearBackground((Color) {
@ -282,15 +288,15 @@ int main(void)
}); });
if (IsKeyPressed(KEY_S)) {
TakeScreenshot("minesweeper-screenshot.png");
}
if (IsKeyPressed(KEY_A)) { if (IsKeyPressed(KEY_A)) {
CloseWindow(); CloseWindow();
exit(0); exit(0);
} }
if (IsKeyPressed(KEY_S)) {
take_screenshot = 1;
}
int resize = 0; int resize = 0;
if (IsKeyPressed(KEY_I)) { if (IsKeyPressed(KEY_I)) {
current_game_type = INTERMEDIATE; current_game_type = INTERMEDIATE;
@ -467,7 +473,7 @@ int main(void)
if (collision(camera_coord, camera_texture, if (collision(camera_coord, camera_texture,
mouse_x, mouse_y)) mouse_x, mouse_y))
{ {
TakeScreenshot("minesweeper-screenshot.png"); take_screenshot = 1;
} }
if (collision(diff_button[0], fixed_tile_texture, if (collision(diff_button[0], fixed_tile_texture,
mouse_x, mouse_y)) mouse_x, mouse_y))