This commit is contained in:
DarthMooMancer
2025-11-14 10:20:00 -05:00
parent 59c68b7bd3
commit 8d4b3990d1
2 changed files with 13 additions and 12 deletions
+5 -7
View File
@@ -1,8 +1,8 @@
#ifndef ENGINE_HPP
#define ENGINE_HPP
#pragma once
#include <string>
#include <vector>
#include <deque>
#include <array>
constexpr int ROW = 11;
constexpr int COL = 11;
@@ -21,7 +21,7 @@ struct vec2 {
struct Window {
std::array<std::array<char, COL>, ROW> view;
void draw_display();
void update_display(vec2 &head, vec2 &fruit, std::vector<vec2> &buf);
void update_display(vec2 &head, vec2 &fruit, std::deque<vec2> &buf);
};
class Engine {
@@ -32,7 +32,7 @@ public:
private:
Window win;
std::vector<vec2> tail;
std::deque<vec2> tail;
std::string status;
vec2 head { COL / 2, ROW / 2 };
vec2 fruit { rand() % COL, rand() % ROW };
@@ -45,5 +45,3 @@ private:
void add_tail_and_respawn_fruit();
bool exit_summary();
};
#endif // ELEMENT_HPP