diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-03 00:22:58 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-03 00:22:58 +0100 |
commit | 07f40f3dc1ef4655844e312ba69be3fbebec51b7 (patch) | |
tree | 4ebc5e65290cace95cac5dabe5cfe8f5a5d4a95a /img | |
parent | 3007b3677ae6a0752a9d1fb136d6ea84c1b6d555 (diff) | |
parent | 0bed01a4e2e820b8974207145cd2eb3430864ad7 (diff) |
merge #49
Diffstat (limited to 'img')
-rw-r--r-- | img/event-sequence.puml | 16 | ||||
-rw-r--r-- | img/event-uml.drawio.png | bin | 0 -> 217362 bytes | |||
-rw-r--r-- | img/gameloop-class.puml | 37 | ||||
-rw-r--r-- | img/gameloop-flow.puml | 26 |
4 files changed, 79 insertions, 0 deletions
diff --git a/img/event-sequence.puml b/img/event-sequence.puml new file mode 100644 index 0000000..2555f33 --- /dev/null +++ b/img/event-sequence.puml @@ -0,0 +1,16 @@ +@startuml +skinparam SequenceParticipantPadding 15 + + +participant EventHandler +participant Publisher +participant EventManager + +EventHandler -> EventManager : Subscribe event +Publisher -> EventManager : trigger event + +EventManager -> EventHandler : execute callback function +Publisher -> EventManager : Queue Event +EventManager -> EventHandler : dispatching queued events +EventHandler -> EventManager : unsubscribe event +@enduml diff --git a/img/event-uml.drawio.png b/img/event-uml.drawio.png Binary files differnew file mode 100644 index 0000000..9eab458 --- /dev/null +++ b/img/event-uml.drawio.png diff --git a/img/gameloop-class.puml b/img/gameloop-class.puml new file mode 100644 index 0000000..e66b7d8 --- /dev/null +++ b/img/gameloop-class.puml @@ -0,0 +1,37 @@ +@startuml +!include theme.ipuml +class LoopManager { + +static LoopManager& getInstance() + + +void loop() + +void setup() + -void render() + -void processInput() + -void fixedUpdate() + -void update() + -bool gameRunning + -LoopManager() +} + +class LoopTimer { + +static LoopTimer& getInstance() + +void start() + +void update() + +float getLag() + +float getFixedDeltaTime() + +void advanceFixedUpdate() + +void enforceFrameRate() + +float getDeltaTime() + -float lag + -float fixedDeltaTime + -float deltaTime +} + +LoopManager --> LoopTimer : uses +LoopManager : loop() +LoopManager : |-- processInput() +LoopManager : |-- fixedUpdate() +LoopManager : |-- update() +LoopManager : |-- render() +' TODO: what is this supposed to be? +@enduml diff --git a/img/gameloop-flow.puml b/img/gameloop-flow.puml new file mode 100644 index 0000000..e75ea42 --- /dev/null +++ b/img/gameloop-flow.puml @@ -0,0 +1,26 @@ +@startuml +!include theme.ipuml +start + +:Initialize LoopManager; +:Start LoopTimer; + +repeat + :Update LoopTimer; + :Check for Events; + :Process Input; + + while (Lag >= Fixed Delta Time?) is (yes) + :Perform Fixed Update; + :Advance Fixed Update; + endwhile + + :Perform Normal Update; + :Render Frame; + +repeat while (Game Running?) + +:Game exit logic; + +stop +@enduml |