wip
This commit is contained in:
+9
-4
@@ -8,7 +8,7 @@
|
||||
|
||||
class Window;
|
||||
|
||||
enum Direction {
|
||||
enum class Direction {
|
||||
UP, DOWN, LEFT, RIGHT
|
||||
};
|
||||
|
||||
@@ -29,9 +29,14 @@ public:
|
||||
private:
|
||||
std::unique_ptr<Window> win;
|
||||
std::vector<vec> buf;
|
||||
bool running = true;
|
||||
enum Direction m_dir;
|
||||
uint8_t m_score = 0;
|
||||
vec head { COL / 2, ROW / 2 };
|
||||
vec fruit { rand() % COL, rand() % ROW };
|
||||
vec prev_head { head.x, head.y };
|
||||
struct {
|
||||
bool running = true;
|
||||
Direction m_dir = Direction::RIGHT;
|
||||
uint8_t m_score = 0;
|
||||
} state;
|
||||
void process_input();
|
||||
void determine_index_zero_pos();
|
||||
void move_tail_indicies();
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
struct Window {
|
||||
std::array<std::array<char, COL>, ROW> board;
|
||||
void draw_display();
|
||||
void update_display(std::vector<vec> &buf);
|
||||
void update_display(vec &head, vec &fruit, std::vector<vec> &buf);
|
||||
};
|
||||
|
||||
#endif // WINDOW_HPP
|
||||
|
||||
Reference in New Issue
Block a user