This commit is contained in:
DarthMooMancer
2025-09-28 18:00:34 -04:00
parent 6529353f2f
commit a0b29a40d1
7 changed files with 96 additions and 57 deletions
+15
View File
@@ -1,10 +1,24 @@
#ifndef ELEMENTS_HPP
#define ELEMENTS_HPP
struct Point;
struct Paddle;
struct Block;
struct Ball;
Paddle create_new_paddle(int size);
enum Direction {
LEFT = -1,
RIGHT = 1,
NONE = 0,
};
struct Point {
Point();
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);
};
@@ -23,6 +37,7 @@ struct Paddle {
Paddle();
int _size;
Point m_nodes[3];
enum Direction m_direction;
void get_new_pos();
void check_collision(Ball &ball);
};
+3 -3
View File
@@ -1,7 +1,7 @@
#ifndef GLOBALS_HPP
#define GLOBALS_HPP
constexpr int ROW = 15;
constexpr int COL = 15;
#define ROW 15
#define COL 15
#define FPMS 300
#endif
+2 -2
View File
@@ -3,8 +3,8 @@
#include "elements.hpp"
struct Input {
char m_getch = ' ';
void get_input(bool &running, Paddle &paddle);
int m_getch;
void get_input(bool &running, enum Direction &dir);
};
#endif // INPUT_HPP
+6 -3
View File
@@ -1,18 +1,21 @@
#ifndef WINDOW_HPP
#define WINDOW_HPP
#include <array>
#include "globals.hpp"
#include "elements.hpp"
struct Window {
Window();
std::array<std::array<char, COL>, ROW> m_board = {};
Point* m_board[ROW][COL] = {};
int m_lives;
void update_display(Paddle &paddle, Ball &ball, Block (&block_list)[15]);
// void update_display(Paddle &paddle, Ball &ball, Block (&block_list)[15]);
void tick(int fps);
void clear();
void terminate(Ball &ball, bool &running);
void clear_display();
void draw_display(int fps);
void update_display(Point** segments, int segments_size);
};
#endif