blob: 087854528e7c3823fa72de51976812706a75c6c1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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;
};
}
|