-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClassTemplate.h
86 lines (57 loc) · 1.27 KB
/
ClassTemplate.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
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
#pragma once
// std
#include <Memory/Box.hpp>
// SFML
#include <SFML/System/Time.hpp>
// Game
#include "Common.h"
// SFML
namespace sf
{
class RenderWindow;
}
// Game
class OwnerClass;
struct Transform;
class World;
/// ClassTemplate description
class ClassTemplate
{
public:
/// Return the static value
static int getStaticValue();
ClassTemplate(OwnerClass&);
~ClassTemplate();
/// Update
virtual void update(World& world, sf::Time deltaTime) = 0;
/// Render
virtual void render(sf::RenderWindow& window);
private:
/// Increment health
void incrementHealth();
public:
/* Static */
/// Static value
static int s_staticValue;
/* Components */
const Box<Transform> mc_transform;
/* Parameters */
/// Initial health
u16 mp_initialHealth;
protected:
/* References to objects with guaranteed lifetime */
/// Direct or indirect owner is guaranteed to live as long as this object,
/// and when it dies, this object will die
OwnerClass& mo_owner;
public:
/* State */
/// Current health
u16 ms_initialHealth;
};
class ChildClass : public ClassTemplate
{
ChildClass();
~ChildClass();
/// Update
virtual void update(World& world, sf::Time deltaTime) override;
};