-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.hh
More file actions
89 lines (68 loc) · 1.83 KB
/
Copy pathgame.hh
File metadata and controls
89 lines (68 loc) · 1.83 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef GAME_HH
#define GAME_HH
#include "mario.hh"
#include "moneda.hh"
#include "fantasma.hh"
#include "platform.hh"
#include "sprites.hh"
#include "window.hh"
#include "finder.hh"
#include "utils.hh"
#include <iostream>
#include <set>
#include <vector>
#include <list>
#include <string>
#include <algorithm>
class Game {
Mario mario_;
Finder<Platform> fplatforms_;
Finder<Moneda> fmonedas_;
Finder<Fantasma> ffantasmas_;
std::list<Platform> platforms_;
std::set<const Moneda*> monedas_;
std::set<const Fantasma*> fantasmas_;
int contador_monedas_;
int vidas_;
bool finished_;
bool paused_;
bool muerto_;
void process_keys(pro2::Window& window);
void update_objects(pro2::Window& window);
void update_camera(pro2::Window& window);
void reset(pro2::Window& window);
template<typename T>
void finder_inicializar(Finder<T>& f, const std::set<const T*>& s) {
for(const T* obj : s) {
f.add(obj);
}
}
template<typename T>
void finder_inicializar(Finder<T>& f, const std::vector<T>& v) {
for(const T& obj : v) {
f.add(&obj);
}
}
template<typename T>
void finder_inicializar(Finder<T>& f, const std::list<T>& l) {
for(const T& obj : l) {
f.add(&obj);
}
}
public:
Game(int width, int height);
~Game();
void update(pro2::Window& window);
void paint(pro2::Window& window);
bool is_finished() const {
return finished_;
}
void matar() {
muerto_ = true;
}
void contador_monedas_visual(pro2::Window& window) const;
void contador_vidas_visual(pro2::Window& window) const;
private:
static constexpr int sky_blue = 0x5c94fc;
};
#endif