removed the input thread and integrated it to the SnakeGame engine itself
This commit is contained in:
+9
-5
@@ -4,6 +4,8 @@
|
||||
#include <vector>
|
||||
#include "globals.hpp"
|
||||
|
||||
class Window;
|
||||
|
||||
enum Direction {
|
||||
UP, DOWN, LEFT, RIGHT
|
||||
};
|
||||
@@ -19,19 +21,21 @@ struct Vector2i {
|
||||
class SnakeGame {
|
||||
public:
|
||||
SnakeGame();
|
||||
// ~SnakeGame();
|
||||
// Vector2i* buf[MAX_LEN] = {};
|
||||
~SnakeGame();
|
||||
void run();
|
||||
|
||||
private:
|
||||
std::vector<Vector2i> buf;
|
||||
bool running = true;
|
||||
enum Direction m_dir;
|
||||
int m_score = 0;
|
||||
Window* win;
|
||||
void process_input();
|
||||
void determine_index_zero_pos();
|
||||
void move_tail_indicies();
|
||||
void on_fruit_eaten(Vector2i (*board)[COL]);
|
||||
bool segment_overlap();
|
||||
bool exit_summary();
|
||||
private:
|
||||
int m_score = 0;
|
||||
// int m_snake_size = 3;
|
||||
};
|
||||
|
||||
#endif // ELEMENT_HPP
|
||||
|
||||
Reference in New Issue
Block a user