feat: added paddles and input for the paddles. Clears everything on screen instead of individual (faster and easier)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#ifndef ELEMENTS_HPP
|
||||
#define ELEMENTS_HPP
|
||||
#include "globals.hpp"
|
||||
#include <array>
|
||||
|
||||
struct Point {
|
||||
int m_row;
|
||||
int m_col;
|
||||
Point();
|
||||
Point(int row, int col) : m_row(row), m_col(col) {};
|
||||
void to_string();
|
||||
void to_string(int index);
|
||||
void clear(std::array<std::array<char, COL>, ROW> &m_board);
|
||||
// void set_new_point(int row, int col);
|
||||
};
|
||||
|
||||
struct Paddle {
|
||||
Paddle(int col);
|
||||
Point m_nodes[4];
|
||||
void get_new_pos(int col);
|
||||
};
|
||||
|
||||
struct Ball {
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
+2
-1
@@ -1,10 +1,11 @@
|
||||
#ifndef INPUT_HPP
|
||||
#define INPUT_HPP
|
||||
#include "elements.hpp"
|
||||
|
||||
struct Input {
|
||||
int m_current_key = 0;
|
||||
char m_getch = ' ';
|
||||
void get_input(bool &r);
|
||||
void get_input(bool &r, Paddle &a, Paddle &b);
|
||||
};
|
||||
|
||||
#endif // INPUT_HPP
|
||||
|
||||
+4
-2
@@ -3,10 +3,12 @@
|
||||
|
||||
#include <array>
|
||||
#include "globals.hpp"
|
||||
#include "elements.hpp"
|
||||
|
||||
struct Window {
|
||||
Window();
|
||||
// Window();
|
||||
std::array<std::array<char, COL>, ROW> m_board;
|
||||
void update_display();
|
||||
// void update_display();
|
||||
void update_display(Paddle &a, Paddle &b);
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user