-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameComponents.cpp
49 lines (38 loc) · 977 Bytes
/
GameComponents.cpp
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "GameComponents.h"
#include "Logger.h"
GameComponents::GameComponents()
{
Logger::get() << "Initializing game components...\n";
// 1 player
player.basePosition = Position(400, 550);
player.position = player.basePosition;
player.size = Size(100, 100);
// 10 bullets
bullets.emplace_back_multiple(10, Sprites::get().bullet, Size(20, 20));
// 50 enemies
enemies.emplace_back_multiple(50, Sprites::get().enemy);
}
std::tuple<Player&, Container<Bullet>&, Container<Enemy>&> GameComponents::getAllComponents()
{
return { player, bullets, enemies };
}
Container<Bullet>& GameComponents::getBullets()
{
return this->bullets;
}
Sounds& GameComponents::getSound() noexcept
{
return this->sounds;
}
Score& GameComponents::getScore() noexcept
{
return this->score;
}
const Canvas& GameComponents::getCanvas() noexcept
{
return this->canvas;
}
Timer& GameComponents::getTimer() noexcept
{
return this->timer;
}