13#include <condition_variable>
18class VideoDriver_SDL_Base :
public VideoDriver {
20 VideoDriver_SDL_Base(
bool uses_hardware_acceleration =
false) : VideoDriver(uses_hardware_acceleration) {}
22 std::optional<std::string_view>
Start(
const StringList ¶m)
override;
26 void MakeDirty(
int left,
int top,
int width,
int height)
override;
76 void MainLoopCleanup();
77 bool CreateMainSurface(uint w, uint h,
bool resize);
78 std::optional<std::string_view> Initialize();
82 static void EmscriptenLoop(
void *self) { ((VideoDriver_SDL_Base *)self)->LoopOnce(); }
90 int startup_display = 0;
std::optional< std::string_view > Start(const StringList ¶m) override
Start this driver.
bool buffer_locked
Video buffer was locked by the main thread.
Dimension GetScreenSize() const override
Get the resolution of the main screen.
bool PollEvent() override
Process a single system event.
void EditBoxLostFocus() override
This is called to indicate that an edit box has lost focus, text input mode should be disabled.
std::string_view GetInfoString() const override
Get some information about the selected driver/backend to be shown to the user.
virtual void ReleaseVideoPointer()=0
Hand video buffer back to the painting backend.
void ClaimMousePointer() override
Claim the exclusive rights for the mouse pointer.
virtual void * GetVideoPointer()=0
Get a pointer to the video buffer.
bool AfterBlitterChange() override
Callback invoked after the blitter was changed.
virtual bool AllocateBackingStore(int w, int h, bool force=false)=0
(Re-)create the backing store.
void InputLoop() override
Handle input logic, is CTRL pressed, should we fast-forward, etc.
Palette local_palette
Current palette to use for drawing.
void MainLoop() override
Perform the actual drawing.
std::string driver_info
Information string about selected driver.
void UnlockVideoBuffer() override
Unlock a previously locked video buffer.
void ClientSizeChanged(int w, int h, bool force)
Indicate to the driver the client-side might have changed.
void MakeDirty(int left, int top, int width, int height) override
Mark a particular area dirty.
virtual bool CreateMainWindow(uint w, uint h, uint flags=0)
Create the main window.
std::vector< int > GetListOfMonitorRefreshRates() override
Get a list of refresh rates of each available monitor.
void SetScreensaverInhibited(bool inhibited) override
Prevents the system from going to sleep.
bool edit_box_focused
This is true to indicate that keyboard input is in text input mode, and SDL_TEXTINPUT events are enab...
bool ChangeResolution(int w, int h) override
Change the resolution of the window.
void Stop() override
Stop this driver.
bool LockVideoBuffer() override
Make sure the video buffer is ready for drawing.
void EditBoxGainedFocus() override
This is called to indicate that an edit box has gained focus, text input mode should be enabled.
Rect dirty_rect
Rectangle encompassing the dirty area of the video buffer.
void CheckPaletteAnim() override
Process any pending palette animation.
struct SDL_Window * sdl_window
Main SDL window.
bool ToggleFullscreen(bool fullscreen) override
Change the full screen setting.
#define Rect
Macro that prevents name conflicts between included headers.
std::vector< std::string > StringList
Type for a list of strings.
Dimensions (a width and height) of a rectangle in 2D.
Base of all video drivers.