adding record game state

This commit is contained in:
_N3m0 2024-03-14 09:22:25 +01:00
parent 896b4b05ae
commit 43ea61277a
1 changed files with 10 additions and 1 deletions

11
main.c
View File

@ -19,6 +19,7 @@ typedef enum GameState {
PLAYING, PLAYING,
WIN, WIN,
LOSE, LOSE,
RECORD,
} GameState; } GameState;
GameState game_state = PLAYING; GameState game_state = PLAYING;
@ -80,6 +81,7 @@ INIT_TEXTURE(t8_image_orig, t8_texture);
Texture camera_texture; Texture camera_texture;
Texture lose_texture; Texture lose_texture;
Texture win_texture; Texture win_texture;
Texture record_texture;
Texture playing_texture; Texture playing_texture;
Texture fixed_tile_texture; Texture fixed_tile_texture;
Texture double_tile_texture; Texture double_tile_texture;
@ -293,6 +295,7 @@ int main(void)
camera_texture = LoadTexture("ressources/camera.png"); camera_texture = LoadTexture("ressources/camera.png");
lose_texture = LoadTexture("ressources/lose.png"); lose_texture = LoadTexture("ressources/lose.png");
win_texture = LoadTexture("ressources/win.png"); win_texture = LoadTexture("ressources/win.png");
record_texture = LoadTexture("ressources/record.png");
playing_texture = LoadTexture("ressources/playing.png"); playing_texture = LoadTexture("ressources/playing.png");
fixed_tile_texture = LoadTexture("ressources/fixed_tile.png"); fixed_tile_texture = LoadTexture("ressources/fixed_tile.png");
double_tile_texture = LoadTexture("ressources/tile_2.png"); double_tile_texture = LoadTexture("ressources/tile_2.png");
@ -361,6 +364,12 @@ int main(void)
menu_color = YELLOW; menu_color = YELLOW;
menu_smiley = &playing_texture; menu_smiley = &playing_texture;
break; break;
case RECORD:
menu_color = BLUE;
menu_smiley = &record_texture;
break;
default:
assert(0 && "game mode not supported");
} }
DrawRectangleRec(menu, menu_color); DrawRectangleRec(menu, menu_color);
@ -482,7 +491,7 @@ int main(void)
game_state = LOSE; game_state = LOSE;
} }
} else if (mouse_in_menu) { } else if (mouse_in_menu) {
if (collision(smiley_coord, playing_texture, if (collision(smiley_coord, *menu_smiley,
mouse_x, mouse_y)) mouse_x, mouse_y))
{ {
reload_game(); reload_game();