This commit is contained in:
DarthMooMancer
2025-11-05 03:41:28 -05:00
parent 1160f3d147
commit c5bb6e34b3
4 changed files with 37 additions and 40 deletions
+9 -4
View File
@@ -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();