summaryrefslogtreecommitdiff
path: root/src/video/sdl2_v.h
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2020-12-06 20:38:34 +0100
committerPatric Stout <github@truebrain.nl>2020-12-15 15:46:39 +0100
commit2da07f76154d841bcfe9aaff4833144550186deb (patch)
tree9594f0b519b5ad91c0c92afc759ca0ae62196cf8 /src/video/sdl2_v.h
parentf2a93dba0d7c4e4f23d9d5cb36e1ede8c02eeeca (diff)
downloadopenttd-2da07f76154d841bcfe9aaff4833144550186deb.tar.xz
Codechange: unroll the SDL2 main loop
This commit prepares for the next commit, as Emscripten needs to have a way to trigger a single iteration of the main loop. To keep the real changes more clear, this commit only unrolls the loop, and makes no changes to the logic itself.
Diffstat (limited to 'src/video/sdl2_v.h')
-rw-r--r--src/video/sdl2_v.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/video/sdl2_v.h b/src/video/sdl2_v.h
index 80d4018a7..6318c403f 100644
--- a/src/video/sdl2_v.h
+++ b/src/video/sdl2_v.h
@@ -42,12 +42,21 @@ public:
const char *GetName() const override { return "sdl"; }
private:
int PollEvent();
+ void LoopOnce();
+ void MainLoopCleanup();
bool CreateMainSurface(uint w, uint h, bool resize);
/**
* This is true to indicate that keyboard input is in text input mode, and SDL_TEXTINPUT events are enabled.
*/
bool edit_box_focused;
+
+ uint32 cur_ticks;
+ uint32 last_cur_ticks;
+ uint32 next_tick;
+
+ std::thread draw_thread;
+ std::unique_lock<std::recursive_mutex> draw_lock;
};
/** Factory for the SDL video driver. */