summary refs log tree commit diff stats
path: root/firmware/include/game/game_state.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/include/game/game_state.h')
-rw-r--r--firmware/include/game/game_state.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/firmware/include/game/game_state.h b/firmware/include/game/game_state.h
new file mode 100644
index 0000000..0878545
--- /dev/null
+++ b/firmware/include/game/game_state.h
@@ -0,0 +1,38 @@
+#pragma once
+
+#include <array>
+#include <stdint.h>
+
+#include "game/blocks.h"
+#include "inputs/input.h"
+
+namespace game {
+
+constexpr uint8_t NUM_ROWS { 20 };
+constexpr uint8_t NUM_COLS { 10 };
+
+class GameState {
+public:
+    GameState();
+
+    void update(const inputs::Input& input);
+
+    uint32_t get_score();
+    uint8_t get_level();
+
+    Block get_next_block();
+
+    Block get_block(uint8_t row, uint8_t col);
+
+private:
+    void move_down();
+    void move_right();
+    void move_left();
+
+    void rotate_right();
+    void rotate_left();
+
+    std::array<Block, NUM_ROWS * NUM_COLS> grid;
+};
+
+}