summaryrefslogtreecommitdiff
path: root/src/video/sdl2_v.h
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-02-11 10:08:04 +0100
committerMichael Lutz <michi@icosahedron.de>2021-02-22 22:16:07 +0100
commite75858ce5e96df30ccb22253ec592d3829e2bccc (patch)
tree723684035f09106a84ac40a961fff9ae4a10f247 /src/video/sdl2_v.h
parent101e394475f25c205ea5806c4daeb0df494111cc (diff)
downloadopenttd-e75858ce5e96df30ccb22253ec592d3829e2bccc.tar.xz
Codechange: [SDL2] Allow several places to hook into the SDL driver
This allows future subdrivers to use these to manage their own flow.
Diffstat (limited to 'src/video/sdl2_v.h')
-rw-r--r--src/video/sdl2_v.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/video/sdl2_v.h b/src/video/sdl2_v.h
index 8793ade18..19c208cfe 100644
--- a/src/video/sdl2_v.h
+++ b/src/video/sdl2_v.h
@@ -52,6 +52,7 @@ protected:
std::recursive_mutex *draw_mutex = nullptr; ///< Mutex to keep the access to the shared memory controlled.
std::condition_variable_any *draw_signal = nullptr; ///< Signal to draw the next frame.
volatile bool draw_continue; ///< Should we keep continue drawing?
+ bool buffer_locked; ///< Video buffer was locked by the main thread.
Dimension GetScreenSize() const override;
void InputLoop() override;
@@ -61,8 +62,17 @@ protected:
void PaintThread() override;
void CheckPaletteAnim() override;
+ /** Indicate to the driver the client-side might have changed. */
+ void ClientSizeChanged(int w, int h, bool force);
+
/** (Re-)create the backing store. */
virtual bool AllocateBackingStore(int w, int h, bool force = false);
+ /** Get a pointer to the video buffer. */
+ virtual void *GetVideoPointer();
+ /** Hand video buffer back to the painting backend. */
+ virtual void ReleaseVideoPointer() {}
+ /** Create the main window. */
+ virtual bool CreateMainWindow(uint w, uint h, uint flags = 0);
private:
int PollEvent();