-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.h
34 lines (26 loc) · 875 Bytes
/
game.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include "objects.h"
namespace arkanoid_cv
{
class game
{
public:
explicit game(world&& world);
[[nodiscard]] unsigned get_lives() const { return lives_; }
[[nodiscard]] unsigned get_score() const { return score_; }
[[nodiscard]] const world& get_world() const { return world_; }
[[nodiscard]] bool has_lost() const { return lives_ == 0u; }
[[nodiscard]] bool has_won() const { return world_.bricks.empty(); }
[[nodiscard]] bool has_ended() const { return has_lost() || has_won(); }
void update();
void move_base(int x);
void start();
private:
void reset();
void handle_ball_collisions();
world world_;
unsigned lives_ = 3u;
unsigned score_ = 0u;
bool ball_on_base_ = true;
};
}