-
Notifications
You must be signed in to change notification settings - Fork 5
/
EngineStructure.puml
240 lines (227 loc) · 4.63 KB
/
EngineStructure.puml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
@startuml
'https://plantuml.com/class-diagram
class Game
class Components
{
<interface>
}
class CTransform
{
pos : Vec2
DEP speed: Vec2
velocity : Vec2
scale : Vec2
angle : float
CTransform(pos,velocity,angle)
}
Entity<|--Components
Components<|--CTransform
Components<|---CInput
Components<|--CLifespan
Components<|---CScore
Components<|--CCollision
Components<|---CShape
Components<|---CBBCollision
Scene <|-- Scene_Menu
Scene <|-- Scene_Play
class CBBCollision
{
size : Vec2
}
class CCollision
{
radius: float
CCollision(float r)
}
class CLifespan
{
remaining:int
total:int
CLifespan(int remain, int total)
}
class CScore
{
score: int
CScore(int s)
}
class CInput
{
up:bool
left:bool
right:bool
down:bool
shoot:bool
SecShoot:bool
}
class CShape
{
shape:sf::CircleShape
CShape(radius,points,colorFill,colOutline,thickness)
}
class Game {
m_window : sf::RenderWindow
m_entities : EntityManager
m_player : Entity
m_paused : bool
m_running : bool
init() : void
update() : void
// Systems()
sMovement() : void
sUserInput() : void
sRender() : void
sEnemySpawner() : void
sCollision() : void
}
class EntityManager
{
m_entities: vector<Entity>
m_entityMap: map<string,Entity>
m_toAdd: vector<Entity>
init(): void
update(): void
addEntity(args): sp<Entity>
getEntities(): vector<sp<Entity>>&
getEntities(s): vector<sp<Entity>>&
}
class Entity
{
m_tag : string
m_active : bool
m_id : size_t
m_components : tuple<C1,C2,.>
DEP cTransform: CTransform
DEP cShape: CShape
DEP cCollision: CCollision
DEP cInput: CInput
DEP cScore: CScore
DEP cLifespan: CLifespan
destroy():void
isActive():bool
tag():string &
id(): size_t
addComponent<C>() : void
hasComponent<C>() : bool
getComponent<C>() : C &
removeCompont<C>(): void
}
class GameEngine
{
sceneMap : map<string,Scene>
m_window : sf::RenderWindow
m_simulationSpeed : size_t
m_assets : Assets
m_currentScene : string
m_running : bool
init(const std::string & path) : void
currentScene() : std::shared_ptr<Scene>
run() : void
update(): void
quit() : void
changeScene(scene) : void
getAssets() : Assets &
window() : Window &
sUserInput() : void
isRunning() : bool
}
abstract Scene
{
m_game : GameEngine *
m_entityManager : EntityManager
m_currentFrame : int
m_actionMap : map<int,string>
m_paused : bool
m_hasEnded : bool
update() : void=0
sDoAction(action) : void=0
sRender() : void=0
simulate(int) : void
doAction(action) : void
registerAction(action) : void
getWidth() : size_t
setPaused(bool paused) : void
}
class Scene_Play
{
m_levelPath : string
m_player : m_entity
playerConfig : PlayerConfig
init() : void
update() : void
// Systems()
sAnimation() : void
sMovement() : void
sEnemySpawner() : void
sCollision() : void
sRender() : void
sDoAction() : void
sDebug() : void
}
class Scene_Menu
{
m_menuStrings : vec<string>
m_menuText : sf::Text
m_levelPath : vec<string>
m_menuIndex : int
init() : void
update() : void
//Systems()
sRender() : void
sDoActions() : void
}
class Assets
{
textureMap : map<string,sf::texture>
animationMap : map<string,Animation>
soundMap : map<string,sf::Sound>
fontMap : map<string,sf::Font>
addTexture(name,path) : void
addAnimation(name,animation) : void
addSound(name,path) : void
addFont(name,path) : void
getTexture(name) : sf::Texture &
getAnimation(name) : Animation &
getSound(name) : sf::Sound &
getFont(name) : sf::Font &
}
class Animation
{
m_sprite : sf::Sprite
m_frameCount : int
m_currentFrame : int
m_speed : int
m_size : Vec2
m_name : string
update() : void
hasEnded() : bool
getName() : string &
getSize() : Vec2 &
getSprite() : sf::Sprite &
}
class FVec2
{
x : double
y : double
operator == : bool
operator != : bool
operator + : Vec2
operator - : Vec2
operator * : Vec2
operator / : Vec2
normalize() : void
length() : double
}
class Action
{
m_name : string
m_type : string
getName() : string &
getType() : string &
}
class Physics
{
isCollision(Entity,Entity) : bool
isIntersect(Line,Line) : bool
isInside(Vec2,Line) : bool
}
@enduml