This commit is contained in:
DarthMooMancer
2025-10-05 21:06:33 -04:00
parent b96acc766e
commit d8a3fee987
9 changed files with 138 additions and 129 deletions
+23 -22
View File
@@ -2,32 +2,33 @@
#define ELEMENTS_HPP
struct Point {
Point(int row, int col) : m_row(row), m_col(col) {};
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;
void assign(int row, int col);
};
struct Tile {
Tile(int row, int col) : m_pos(row, col), m_symbol(' '), _delete(false) {};
Tile(int row, int col, char symbol) : m_pos(row, col), m_symbol(symbol), _delete(false) {};
char m_symbol;
Point m_pos;
bool _delete;
};
struct Border {
Border(int row, int col, char symbol) : m_pos(row, col), m_symbol(symbol) {};
char m_symbol;
Point m_pos;
};
struct Player {
Player(char symbol, bool turn) : m_symbol(symbol), m_turn(turn), m_win(false) {};
char m_symbol;
bool m_turn;
bool m_win;
void check_line(Tile (&tile_list)[9]);
};
// struct Tile {
// Tile(int row, int col) : m_pos(row, col), m_symbol(' '), _delete(false) {};
// Tile(int row, int col, char symbol) : m_pos(row, col), m_symbol(symbol), _delete(false) {};
// char m_symbol;
// Point m_pos;
// bool _delete;
// };
//
// struct Border {
// Border(int row, int col, char symbol) : m_pos(row, col), m_symbol(symbol) {};
// char m_symbol;
// Point m_pos;
// };
//
// struct Player {
// Player(char symbol, bool turn) : m_symbol(symbol), m_turn(turn), m_win(false) {};
// char m_symbol;
// bool m_turn;
// bool m_win;
// void check_line(Tile (&tile_list)[9]);
// };
#endif
+3 -3
View File
@@ -1,7 +1,7 @@
#ifndef GLOBALS_HPP
#define GLOBALS_HPP
constexpr int ROW = 5;
constexpr int COL = 5;
#define ROW 5
#define COL 5
#define FMPS 150
#endif
+2 -1
View File
@@ -4,7 +4,8 @@
struct Input {
int _getch = 0;
void get_input(bool &running, Tile (&tile_list)[9], Player &player_one, Player &player_two);
// void get_input(bool &running, Tile (&tile_list)[9], Player &player_one, Player &player_two);
void get_input(bool &running);
};
#endif
+6 -4
View File
@@ -1,14 +1,16 @@
#ifndef WINDOW_HPP
#define WINDOW_HPP
#include <array>
#include "globals.hpp"
#include "elements.hpp"
struct Window {
std::array<std::array<char, COL>, ROW> m_board = {};
void update_display(Tile (&tile_list)[9], Border (&border_list)[16]);
void terminate(Tile (&tile_list)[9], bool &running);
Point* m_board[ROW][COL] = {};
// void terminate(Tile (&tile_list)[9], bool &running);
void clear_display();
void update_display(Point** buffer);
void draw_display(int fps);
};
#endif