wip
This commit is contained in:
+23
-16
@@ -4,39 +4,46 @@
|
||||
#include "globals.hpp"
|
||||
|
||||
enum Direction {
|
||||
NONE = 0,
|
||||
UP = -1,
|
||||
DOWN = 1
|
||||
NONE, UP, DOWN
|
||||
};
|
||||
|
||||
struct Point {
|
||||
Point() : m_row(0), m_col(0) {};
|
||||
Point(int r, int c, char s) : m_row(r), m_col(c), m_symbol(s) {};
|
||||
int m_row;
|
||||
int m_col;
|
||||
struct vec2 {
|
||||
vec2() : y(0), x(0) {};
|
||||
vec2(int r, int c, char s) : y(r), x(c), m_symbol(s) {}
|
||||
int x, y;
|
||||
char m_symbol;
|
||||
};
|
||||
|
||||
|
||||
struct Ball {
|
||||
Ball() : m_vx(1), m_vy(-1) {};
|
||||
Point* m_origin;
|
||||
vec2* m_origin;
|
||||
int m_vx;
|
||||
int m_vy;
|
||||
bool determine_next_valid_position(Point* (*board)[COL]);
|
||||
bool determine_next_valid_position();
|
||||
};
|
||||
|
||||
struct Paddle {
|
||||
Paddle() : m_score(0) {};
|
||||
int m_score;
|
||||
int m_size;
|
||||
Point** m_nodes;
|
||||
vec2** m_nodes;
|
||||
enum Direction m_dir;
|
||||
void determine_new_position(Point* (*board)[COL]);
|
||||
void determine_new_position(vec2* (*board)[COL]);
|
||||
};
|
||||
|
||||
void on_collision_with_ball(Point** segments, Ball &ball, int t_size);
|
||||
Ball create_ball(Point** segments, int row, int col, char symbol, int t_size);
|
||||
Paddle create_paddle(Point** segments, int starting_index, int ending_index, int column, char symbol);
|
||||
class Engine {
|
||||
public:
|
||||
Engine();
|
||||
~Engine();
|
||||
void run();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
void on_collision_with_ball(vec2** segments, Ball &ball, int t_size);
|
||||
Ball create_ball(vec2** segments, int row, int col, char symbol, int t_size);
|
||||
Paddle create_paddle(vec2** segments, int starting_index, int ending_index, int column, char symbol);
|
||||
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@
|
||||
#include "elements.hpp"
|
||||
|
||||
struct Window {
|
||||
Point* m_board[ROW][COL] = {};
|
||||
vec2* m_board[ROW][COL] = {};
|
||||
void clear_display();
|
||||
void draw_display(int milliseconds);
|
||||
void update_display(Point** segments);
|
||||
void update_display(vec2** segments);
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user