choose game mode

pvp, pvc, cvc
This commit is contained in:
andrea
2026-03-21 10:24:15 +01:00
parent 7f63ae9a31
commit a9aed6b8d0
7 changed files with 292 additions and 208 deletions

View File

@@ -11,21 +11,22 @@ enum EngineEvents : uint8_t {NONE, P1SCORE, P2SCORE, P1_COLLISION, P2_COLLISION,
class Engine {
private:
Paddle& _p1;
Paddle& _p2;
Paddle* _p1;
Paddle* _p2;
Ball& _ball;
EngineEvents _event= NONE;
uint8_t _ball_mv_delay;
uint8_t _hits = 0;
bool _check_pad_ball_collision(Paddle &p);
bool _check_pad_ball_collision(Paddle *p);
public:
// inizialize Engine constructor, linking all args with private args
Engine(Paddle &p_one, Paddle &p_two, Ball &ball, uint8_t ball_mv_delay)
: _p1(p_one), _p2(p_two), _ball(ball), _ball_mv_delay(ball_mv_delay) {}
Engine(Ball &ball, uint8_t ball_mv_delay)
: _ball(ball), _ball_mv_delay(ball_mv_delay) {}
void run();
void set_players(Paddle *p_one, Paddle *p_two);
bool control_players();
uint8_t ball_movement_delay();
EngineEvents get_event();