summaryrefslogtreecommitdiffhomepage
path: root/StarsEx/Game.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-04-04 22:28:16 +0200
committerAki <please@ignore.pl>2022-04-04 22:28:16 +0200
commit1bc6242caac5261dfd74be55027aa033f7a297a4 (patch)
treea4439aa20f59eb12fe8fdfd093014bd019892934 /StarsEx/Game.cpp
parent4cc312f90d27ea7abb010bd317188d9d08a9fd3e (diff)
downloadstarshatter-1bc6242caac5261dfd74be55027aa033f7a297a4.zip
starshatter-1bc6242caac5261dfd74be55027aa033f7a297a4.tar.gz
starshatter-1bc6242caac5261dfd74be55027aa033f7a297a4.tar.bz2
Streamlined game loops
Diffstat (limited to 'StarsEx/Game.cpp')
-rw-r--r--StarsEx/Game.cpp33
1 files changed, 8 insertions, 25 deletions
diff --git a/StarsEx/Game.cpp b/StarsEx/Game.cpp
index 4fda01e..41375f9 100644
--- a/StarsEx/Game.cpp
+++ b/StarsEx/Game.cpp
@@ -136,37 +136,20 @@ Game::Pause(bool f)
// +--------------------------------------------------------------------+
-bool
+void
Game::GameLoop()
{
- bool wait_for_windows_events = true;
-
- if (active && !paused) {
- if (!server) {
- // Route Events to EventTargets
- EventDispatch* ed = EventDispatch::GetInstance();
- if (ed)
- ed->Dispatch();
- }
-
- UpdateWorld();
- GameState();
-
- if (!server) {
- UpdateScreen();
- }
-
- wait_for_windows_events = false;
+ if (active) {
+ auto dispatch = EventDispatch::GetInstance();
+ if (dispatch)
+ dispatch->Dispatch();
}
- else if (active && paused) {
- if (GetKey()=='P')
- Pause(false);
- }
-
+ UpdateWorld();
+ GameState();
+ UpdateScreen();
Clock::GetInstance()->Step();
frame_number++;
Mouse::w = 0;
- return wait_for_windows_events;
}
// +--------------------------------------------------------------------+