final refinement for the day 1 challenge that was supposed to be a bigger project in my head
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user