final refinement for the day 1 challenge that was supposed to be a bigger project in my head

This commit is contained in:
DarthMooMancer
2025-08-30 23:18:00 -04:00
parent fbdf7af31e
commit efa2952ae2
7 changed files with 25 additions and 51 deletions
+4 -9
View File
@@ -1,23 +1,18 @@
#ifndef ELEMENTS_HPP
#define ELEMENTS_HPP
#include "globals.hpp"
#include <array>
struct Point {
Point();
int m_row;
int m_col;
Point();
Point(int row, int col) : m_row(row), m_col(col) {};
void to_string();
void clear(std::array<std::array<char, COL>, ROW> &m_board);
void assign(int row, int col);
};
struct Ball {
Ball();
Point m_origin;
int m_vx = 1;
int m_vy = -1;
int m_vx;
int m_vy;
bool m_goal;
void get_new_pos();
void check_collision();
@@ -28,7 +23,7 @@ struct Paddle {
Paddle(int col);
int _size;
int m_score;
Point m_nodes[4];
Point m_nodes[3];
void get_new_pos(int col);
void check_collision(Ball &ball);
};
+2 -2
View File
@@ -1,7 +1,7 @@
#ifndef GLOBALS_HPP
#define GLOBALS_HPP
constexpr unsigned int ROW = 10;
constexpr unsigned int COL = 21;
constexpr unsigned int ROW = 15;
constexpr unsigned int COL = 31;
#endif
-1
View File
@@ -3,7 +3,6 @@
#include "elements.hpp"
struct Input {
int m_current_key = 0;
char m_getch = ' ';
void get_input(bool &r, Paddle &a, Paddle &b);
};