aboutsummaryrefslogtreecommitdiff
path: root/src/games/minesweeper/Minesweeper.hpp
diff options
context:
space:
mode:
authorfschildt <florian.schildt@protonmail.com>2025-10-18 11:33:30 +0200
committerfschildt <florian.schildt@protonmail.com>2025-10-18 11:38:45 +0200
commit935f1971bee684c6c9baded2564a550351cc5582 (patch)
treee4650d9b39b108be52638f6b45681b42dfc72b15 /src/games/minesweeper/Minesweeper.hpp
parent7935895480b74fb9fe02e5f26a82265a72604d77 (diff)
minesweeper: add win/lose conditionHEADmaster
Diffstat (limited to 'src/games/minesweeper/Minesweeper.hpp')
-rw-r--r--src/games/minesweeper/Minesweeper.hpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/games/minesweeper/Minesweeper.hpp b/src/games/minesweeper/Minesweeper.hpp
index fbdcb30..1db77ff 100644
--- a/src/games/minesweeper/Minesweeper.hpp
+++ b/src/games/minesweeper/Minesweeper.hpp
@@ -25,8 +25,9 @@ private:
void ProcessEventDuringResume(SDL_Event& event);
void Reset(Difficulty Difficulty);
- void InitIsMineBitmap(int32_t mine_count);
+ void InitIsMineBitmap();
void InitAdjacentMineCounters();
+ bool IsWon();
void UncoverMines();
void Uncover(int32_t x, int32_t y);
@@ -43,28 +44,32 @@ private:
private:
void DrawBoard();
void DrawStartMenu();
+ void DrawGameOverMenu();
private:
- static constexpr int32_t max_map_height = 32;
- static constexpr int32_t max_map_width = 32;
+ static constexpr int32_t s_max_grid_height = 32;
+ static constexpr int32_t s_max_grid_width = 32;
private:
Difficulty m_difficulty = beginner;
+ int32_t m_cells_uncovered;
+ int32_t m_mine_count;
float m_world_width = 4.0f;
float m_world_height = 3.0f;
int32_t m_grid_width;
- int32_t m_grid_height; V2F32 m_grid_pos;
+ int32_t m_grid_height;
+ V2F32 m_grid_pos;
V2F32 m_cell_outer_size;
V2F32 m_cell_inner_size;
- uint32_t m_is_covered_bitmap[max_map_height] {};
- uint32_t m_is_flagged_bitmap[max_map_height] {};
- uint32_t m_is_mine_bitmap[max_map_height] {};
- int32_t m_adjacent_mine_counts[max_map_width * max_map_height] {};
+ uint32_t m_is_covered_bitmap[s_max_grid_height] {};
+ uint32_t m_is_flagged_bitmap[s_max_grid_height] {};
+ uint32_t m_is_mine_bitmap[s_max_grid_height] {};
+ int32_t m_adjacent_mine_counts[s_max_grid_width * s_max_grid_height] {};
Font m_font;
};