moving a bunch of things around
This commit is contained in:
+30
-13
@@ -17,18 +17,24 @@ bool is_block_buffer_empty(Block** block_buffer, int block_buffer_size);
|
||||
|
||||
enum Direction { LEFT, RIGHT, NONE };
|
||||
|
||||
struct Window {
|
||||
char view[ROW][COL] = {};
|
||||
void clear_display();
|
||||
void draw_display(int fps);
|
||||
void update_board(Paddle paddle, Ball ball);
|
||||
};
|
||||
|
||||
struct vec2 {
|
||||
vec2() : x(0), y(0) {};
|
||||
vec2(int x, int y) : x(x), y(y) {};
|
||||
vec2(int x, int y, char symbol) : x(x), y(y), m_symbol(symbol) {};
|
||||
int x, y;
|
||||
char m_symbol;
|
||||
void set(int x, int y);
|
||||
void set(int _x, int _y) { x = _x; y = _y; };
|
||||
auto operator <=> (const vec2&) const = default;
|
||||
};
|
||||
|
||||
struct Ball {
|
||||
Ball();
|
||||
vec2 m_origin { COL / 2, ROW - 5, '*' };
|
||||
vec2 vel { 1, -1 };
|
||||
void determine_new_position(int &paddle_lives, int reset_ball_x, int reset_ball_y);
|
||||
@@ -40,19 +46,30 @@ struct Paddle {
|
||||
int _size;
|
||||
int m_hearts { 3 };
|
||||
std::array<vec2, 3> m_nodes;
|
||||
enum Direction m_direction;
|
||||
enum Direction dir;
|
||||
void determine_new_position(char (*board)[COL]);
|
||||
void check_collision(Ball &ball);
|
||||
};
|
||||
|
||||
struct Block {
|
||||
Block();
|
||||
Block(vec2 pos, char symbol);
|
||||
~Block();
|
||||
std::array<vec2, 3> m_nodes = {};
|
||||
bool check_collision(Ball &ball);
|
||||
};
|
||||
|
||||
// class Engine {
|
||||
//
|
||||
// struct Block {
|
||||
// Block();
|
||||
// Block(vec2 pos, char symbol);
|
||||
// ~Block();
|
||||
// std::array<vec2, 3> m_nodes = {};
|
||||
// bool check_collision(Ball &ball);
|
||||
// };
|
||||
|
||||
class Engine {
|
||||
public:
|
||||
Engine();
|
||||
~Engine();
|
||||
void run();
|
||||
|
||||
private:
|
||||
Window win;
|
||||
Paddle paddle;
|
||||
Ball ball;
|
||||
bool process_input();
|
||||
bool quit_if();
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user