This commit is contained in:
DarthMooMancer
2025-11-06 17:34:42 -05:00
parent 0a07d776ce
commit fccc07600a
11 changed files with 193 additions and 205 deletions
+23 -13
View File
@@ -1,24 +1,34 @@
#ifndef ELEMENTS_HPP
#define ELEMENTS_HPP
struct Point;
struct Player;
void cleanup(Point** buffer, int buffer_size);
void allocate_points(Point** buffer, char symbol);
Player* get_current_player(Player* current_player, Player* player_one, Player* player_two);
#include <memory>
struct Point {
Point(int row, int col, char symbol) : m_row(row), m_col(col), m_symbol(symbol) {};
int m_row;
int m_col;
char m_symbol;
};
class Window;
struct Player {
Player(char symbol, bool turn, int id) : m_symbol(symbol), m_id(id) {};
Player(char symbol, int id) : m_symbol(symbol), m_id(id) {};
char m_symbol;
int m_id;
bool on_line(Point** buffer);
bool on_line();
};
class Engine {
public:
Engine();
~Engine();
void run();
private:
std::unique_ptr<Window> win;
struct GameState {
Player player1;
Player player2;
Player *temp;
GameState() : player1('x', 1), player2('o', 2), temp { &player1 } {};
} state;
void get_current_player();
bool process_input();
bool exit_code();
};
#endif