feat: input_tile and players
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#ifndef ELEMENTS_HPP
|
||||
#define ELEMENTS_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
struct Point {
|
||||
Point() : m_row(0), m_col(0), m_id(0), m_active(true) {}
|
||||
Point(int row, int col, int id) : m_row(row), m_col(col), m_id(id), m_active(true) {}
|
||||
int m_row;
|
||||
int m_col;
|
||||
int m_id;
|
||||
bool m_active;
|
||||
char m_symbol;
|
||||
void assign(int row, int col);
|
||||
void move();
|
||||
void check_collision(std::vector<Point> &points_list);
|
||||
};
|
||||
|
||||
struct Player {
|
||||
Player(char symbol, bool turn) : m_symbol(symbol), m_turn(turn) {}
|
||||
char m_symbol;
|
||||
bool m_turn;
|
||||
std::vector<Point> m_points;
|
||||
void input_tile(int col, std::vector<Point> &points);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef GLOBALS_HPP
|
||||
#define GLOBALS_HPP
|
||||
|
||||
constexpr int ROW = 6;
|
||||
constexpr int COL = 7;
|
||||
|
||||
#endif
|
||||
+3
-1
@@ -1,9 +1,11 @@
|
||||
#ifndef INPUT_HPP
|
||||
#define INPUT_HPP
|
||||
|
||||
#include "elements.hpp"
|
||||
|
||||
struct Input {
|
||||
int _getch = 0;
|
||||
void get_input(bool &running);
|
||||
void get_input(bool &running, Player &one, Player &two, std::vector<Point> &points);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef WINDOW_HPP
|
||||
#define WINDOW_HPP
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include "globals.hpp"
|
||||
#include "elements.hpp"
|
||||
|
||||
struct Window {
|
||||
std::array<std::array<char, COL>, ROW> m_board = {};
|
||||
void update_display(std::vector<Point> &points_list);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user