feat: added paddles and input for the paddles. Clears everything on screen instead of individual (faster and easier)

This commit is contained in:
DarthMooMancer
2025-08-30 16:20:50 -04:00
parent c2b99a82df
commit fe8e4346a2
8 changed files with 113 additions and 29 deletions
+27
View File
@@ -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
View File
@@ -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
View File
@@ -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