diff options
| author | fschildt <florian.schildt@protonmail.com> | 2025-12-13 04:12:10 +0100 |
|---|---|---|
| committer | fschildt <florian.schildt@protonmail.com> | 2025-12-13 04:12:10 +0100 |
| commit | ebe4a92027aabc9c01caf0fbe791d22773abfe75 (patch) | |
| tree | e697282a885f54de7af22f36a58c1a684f67faf0 /src/games/snake/Snake.hpp | |
| parent | f24d302be51f8cd2f4c5796283ea9f9a3be8d922 (diff) | |
Diffstat (limited to 'src/games/snake/Snake.hpp')
| -rw-r--r-- | src/games/snake/Snake.hpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/games/snake/Snake.hpp b/src/games/snake/Snake.hpp index 81fd30f..0303238 100644 --- a/src/games/snake/Snake.hpp +++ b/src/games/snake/Snake.hpp @@ -2,6 +2,7 @@ #include "games/Game.hpp" #include "common/math.hpp" +#include "common/Font.hpp" #include <random> @@ -29,18 +30,23 @@ private: void MaybeMoveSnake(float dt_in_seconds); void SpawnFood(); + void HandleGameOver(); + private: static constexpr int32_t max_map_width = 16; static constexpr int32_t max_map_height = 16; static constexpr float tiles_per_second = 4.0f; + static constexpr char highscore_path[] = "snake_highscore.txt"; + + Font m_font; static std::mt19937 s_rng; std::uniform_int_distribution<int32_t> m_dist; - int32_t m_starting_map_width = 16; - int32_t m_starting_map_height = 16; + int32_t m_starting_map_width = 12; + int32_t m_starting_map_height = 12; Direction m_direction; Direction m_last_advanced_direction; @@ -52,6 +58,9 @@ private: uint64_t m_body_bitmap[max_map_height]; V2I32 m_body_positions[max_map_width * max_map_height]; V2I32 m_food_position; + + int32_t m_score; + int32_t m_highscore; }; |
