#pragma once #include "games/Game.hpp" #include "games/tetris/Tetromino.hpp" #include "games/tetris/Board.hpp" #include "common/Font.hpp" class Tetris : public Game { public: Tetris(); private: void Start() override; void ProcessEvent(SDL_Event& event) override; void FinishUpdate(float dt) override; void Draw() override; void DrawGameOverMenu() override; uint32_t GetSoftdropCount(float dt); void HandleTetrominoPlacement(); int32_t ReadHighscore(); void WriteHighscore(); void DrawLineCounter(); void DrawStatistics(); void DrawScore(); void DrawNextTetromino(); void DrawLevel(); private: static constexpr Color s_text_color {0.9f, 0.9f, 0.9f, 1.0f}; static constexpr size_t s_frame_strings_capacity {32}; static constexpr char s_tetris_highscore_path[]{"tetris_highscore.txt"}; Font m_font; Board m_board; Tetromino m_active_tetromino; Tetromino::Id m_next_tetromino_id; int32_t m_tetromino_counters[Tetromino::id_count] {}; int32_t m_score = 0; int32_t m_line_counter = 0; int32_t m_starting_level = 0; int32_t m_level = 0; int32_t m_softdrop_counter = 0; int32_t m_highscore = 0; };