can draw block buffer to screen and collide but the collide is broken
This commit is contained in:
+13
-10
@@ -8,8 +8,11 @@ struct Paddle;
|
||||
struct Block;
|
||||
struct Ball;
|
||||
Paddle create_new_paddle(Point** buffer, int starting_array_index, int size, int row, char symbol);
|
||||
Block create_new_block(char symbol, int row, int col, int size);
|
||||
Block* create_block_buffer(Point** buffer, int starting_symbol, int rows, int col, int length);
|
||||
Ball create_new_ball(Point** buffer, int index, int default_vx, int default_vy, int row, int col, char symbol);
|
||||
Block** create_block_buffer(int starting_array_index, int starting_symbol, int rows, int cols, int length);
|
||||
void rasterize_block(Point** buffer, Block* block, int starting_index);
|
||||
void rasterize_buffer(Point** buffer, Block** block_buffer, int offset);
|
||||
void trim_block_buffer_on_collision(Block** block_buffer, int block_buffer_size, Ball &ball);
|
||||
|
||||
enum Direction {
|
||||
LEFT = -1,
|
||||
@@ -25,16 +28,16 @@ struct Point {
|
||||
int m_col;
|
||||
char m_symbol;
|
||||
void assign(int row, int col);
|
||||
void to_string();
|
||||
};
|
||||
|
||||
struct Ball {
|
||||
Ball();
|
||||
Point m_origin;
|
||||
Ball(int default_vx, int default_vy) : vx(default_vx), vy(default_vy) {};
|
||||
Point* m_origin;
|
||||
int vx;
|
||||
int vy;
|
||||
int m_blocks_left;
|
||||
void get_new_pos();
|
||||
void check_collision();
|
||||
void determine_new_position();
|
||||
void change_velocity(char d);
|
||||
};
|
||||
|
||||
@@ -49,14 +52,14 @@ struct Paddle {
|
||||
};
|
||||
|
||||
struct Block {
|
||||
// Block();
|
||||
// Block(char symbol, int row, int col, int size);
|
||||
// ~Block();
|
||||
Block();
|
||||
Block(int size, int row, int col, char symbol);
|
||||
~Block();
|
||||
int _size;
|
||||
int _deleted;
|
||||
Point** m_nodes;
|
||||
void get_pos();
|
||||
void check_collision(Ball &ball, int &blocks_left);
|
||||
bool check_collision(Ball &ball);
|
||||
void _delete();
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@
|
||||
#define GLOBALS_HPP
|
||||
#define ROW 15
|
||||
#define COL 15
|
||||
#define FPMS 100
|
||||
#define FPMS 150
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ struct Window {
|
||||
|
||||
void clear_display();
|
||||
void draw_display(int fps);
|
||||
void update_display(Point** buffer, int buffer_size);
|
||||
void update_board(Point** buffer, int buffer_size);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user