summaryrefslogtreecommitdiff
path: root/src/video/sdl2_v.h
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-02-11 21:03:18 +0100
committerMichael Lutz <michi@icosahedron.de>2021-02-22 22:16:07 +0100
commit421b599541069318817bd0e0768984a662a84753 (patch)
treee75bb0ce744314803560a44ec9dff11cb7c315cb /src/video/sdl2_v.h
parenta3039403729abb52679984a55e8d46fc527629b2 (diff)
downloadopenttd-421b599541069318817bd0e0768984a662a84753.tar.xz
Codechange: [SDL2] Split driver in base-part and default backend
Diffstat (limited to 'src/video/sdl2_v.h')
-rw-r--r--src/video/sdl2_v.h26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/video/sdl2_v.h b/src/video/sdl2_v.h
index cfd82d151..7042bf270 100644
--- a/src/video/sdl2_v.h
+++ b/src/video/sdl2_v.h
@@ -15,9 +15,9 @@
#include "video_driver.hpp"
/** The SDL video driver. */
-class VideoDriver_SDL : public VideoDriver {
+class VideoDriver_SDL_Base : public VideoDriver {
public:
- VideoDriver_SDL() : sdl_window(nullptr) {}
+ VideoDriver_SDL_Base() : sdl_window(nullptr) {}
const char *Start(const StringList &param) override;
@@ -59,19 +59,17 @@ protected:
void InputLoop() override;
bool LockVideoBuffer() override;
void UnlockVideoBuffer() override;
- void Paint() override;
- 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);
+ virtual bool AllocateBackingStore(int w, int h, bool force = false) = 0;
/** Get a pointer to the video buffer. */
- virtual void *GetVideoPointer();
+ virtual void *GetVideoPointer() = 0;
/** Hand video buffer back to the painting backend. */
- virtual void ReleaseVideoPointer() {}
+ virtual void ReleaseVideoPointer() = 0;
/** Create the main window. */
virtual bool CreateMainWindow(uint w, uint h, uint flags = 0);
@@ -81,13 +79,10 @@ private:
void MainLoopCleanup();
bool CreateMainSurface(uint w, uint h, bool resize);
const char *Initialize();
- bool CreateMainWindow(uint w, uint h);
- void UpdatePalette();
- void MakePalette();
#ifdef __EMSCRIPTEN__
/* Convert a constant pointer back to a non-constant pointer to a member function. */
- static void EmscriptenLoop(void *self) { ((VideoDriver_SDL *)self)->LoopOnce(); }
+ static void EmscriptenLoop(void *self) { ((VideoDriver_SDL_Base *)self)->LoopOnce(); }
#endif
/**
@@ -99,14 +94,7 @@ private:
std::thread draw_thread;
std::unique_lock<std::recursive_mutex> draw_lock;
- static void PaintThreadThunk(VideoDriver_SDL *drv);
-};
-
-/** Factory for the SDL video driver. */
-class FVideoDriver_SDL : public DriverFactoryBase {
-public:
- FVideoDriver_SDL() : DriverFactoryBase(Driver::DT_VIDEO, 5, "sdl", "SDL Video Driver") {}
- Driver *CreateInstance() const override { return new VideoDriver_SDL(); }
+ static void PaintThreadThunk(VideoDriver_SDL_Base *drv);
};
#endif /* VIDEO_SDL_H */