aboutsummaryrefslogtreecommitdiff
path: root/src/games/tetris/Tetris.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/games/tetris/Tetris.hpp')
-rw-r--r--src/games/tetris/Tetris.hpp45
1 files changed, 15 insertions, 30 deletions
diff --git a/src/games/tetris/Tetris.hpp b/src/games/tetris/Tetris.hpp
index e517f1c..b3ace1d 100644
--- a/src/games/tetris/Tetris.hpp
+++ b/src/games/tetris/Tetris.hpp
@@ -6,27 +6,18 @@
#include <games/tetris/Board.hpp>
-enum class TetrisRunningState {
- Resume,
- Pause,
- GameOver,
- Restart,
- Exit
-};
-
-
class Tetris : public Game {
public:
- Tetris();
+ Tetris() = default;
bool Update(std::vector<SDL_Event> &events) override;
void HandleTetrominoPlacement();
private:
- void Restart();
+ void Start();
void UpdateResumeState(SDL_Event &event);
void UpdatePauseState(SDL_Event &event);
- uint32_t GetHarddropCount(float dt);
+ uint32_t GetSoftdropCount(float dt);
void HandleGameOver();
void Draw();
@@ -36,7 +27,6 @@ private:
void DrawNextTetromino();
void DrawLevel();
- void DrawPauseMenu();
void DrawGameOverMenu();
private:
@@ -45,23 +35,18 @@ private:
private:
- TetrisRunningState m_RunningState = TetrisRunningState::Resume;
-
- float m_DtInSecondsRemaining = 0.0f;
- uint64_t m_MillisecondsSinceT0Last = SDL_GetTicks();
-
- Board m_Board;
- Tetromino m_ActiveTetromino;
- Tetromino m_NextTetromino;
-
- int32_t m_TetrominoCounters[Tetromino::tetromino_id_count] {};
- int32_t m_Score = 0;
- int32_t m_LineCounter = 0;
- int32_t m_StartingLevel = 0;
- int32_t m_Level = 0;
- int32_t m_SoftdropCounter = 0;
-
- int32_t m_HighScore = 0;
+ Board m_board;
+ Tetromino m_active_tetromino;
+ Tetromino m_next_tetromino;
+
+ 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;
};