63 std::optional<std::string_view> Initialize();
64 bool MakeWindow(
bool full_screen,
bool resize =
true);
100 friend LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
105 std::optional<std::string_view>
Start(
const StringList ¶m)
override;
107 void Stop()
override;
111 std::string_view
GetName()
const override {
return "win32"; }
118 void Paint()
override;
124 void UpdatePalette(HDC dc, uint start, uint count);
128 static int RedrawScreenDebug();
136 std::unique_ptr<Driver>
CreateInstance()
const override {
return std::make_unique<VideoDriver_Win32GDI>(); }
144 VideoDriver_Win32OpenGL() : VideoDriver_Win32Base(true, true), driver_info(this->GetName()) {}
146 std::optional<std::string_view>
Start(
const StringList ¶m)
override;
148 void Stop()
override;
164 std::string_view
GetName()
const override {
return "win32-opengl"; }
166 std::string_view
GetInfoString()
const override {
return this->driver_info; }
170 HGLRC gl_rc =
nullptr;
171 std::string driver_info;
175 void Paint()
override;
182 std::optional<std::string_view> AllocateContext();
183 void DestroyContext();
189 FVideoDriver_Win32OpenGL() : DriverFactoryBase(
Driver::Type::
Video, 9,
"win32-opengl",
"Win32 OpenGL Video Driver") {}
190 std::unique_ptr<Driver>
CreateInstance()
const override {
return std::make_unique<VideoDriver_Win32OpenGL>(); }
Base for all driver factories.
virtual bool UsesHardwareAcceleration() const
Does the driver use hardware acceleration (video-drivers only).
DriverFactoryBase(Driver::Type type, int priority, std::string_view name, std::string_view description)
Construct a new DriverFactory.
virtual std::unique_ptr< Driver > CreateInstance() const =0
Create an instance of this driver-class.
virtual std::string_view GetName() const =0
Get the name of this driver.
virtual std::optional< std::string_view > Start(const StringList &parm)=0
Start this driver.
std::unique_ptr< Driver > CreateInstance() const override
Create an instance of this driver-class.
Base class for Windows video drivers.
int height
Height in pixels of our display surface.
bool has_focus
Does our window have system focus?
void EditBoxLostFocus() override
An edit box lost the input focus.
void CheckPaletteAnim() override
Process any pending palette animation.
VideoDriver_Win32Base(bool uses_hardware_acceleration=false, bool supports_animation_buffer=false)
Create the video driver.
void Stop() override
Stop this driver.
int height_org
Original monitor resolution height, before we changed it.
HWND main_wnd
Handle to system window.
bool fullscreen
Whether to use (true) fullscreen mode.
int width_org
Original monitor resolution width, before we changed it.
bool MakeWindow(bool full_screen, bool resize=true)
Instantiate a new window.
bool buffer_locked
Video buffer was locked by the main thread.
virtual void * GetVideoPointer()=0
Get a pointer to the video buffer.
void MakeDirty(int left, int top, int width, int height) override
Mark a particular area dirty.
bool PollEvent() override
Process a single system event.
virtual void PaletteChanged(HWND hWnd)=0
Palette of the window has changed.
bool LockVideoBuffer() override
Make sure the video buffer is ready for drawing.
std::vector< int > GetListOfMonitorRefreshRates() override
Get a list of refresh rates of each available monitor.
virtual bool AllocateBackingStore(int w, int h, bool force=false)=0
(Re-)create the backing store.
int width
Width in pixels of our display surface.
void InputLoop() override
Handle input logic, is CTRL pressed, should we fast-forward, etc.
virtual uint8_t GetFullscreenBpp()
Colour depth to use for fullscreen display modes.
Dimension GetScreenSize() const override
Get the resolution of the main screen.
virtual void ReleaseVideoPointer()
Hand video buffer back to the painting backend.
Palette local_palette
Current palette to use for drawing.
void UnlockVideoBuffer() override
Unlock a previously locked video buffer.
virtual bool MinimiseRestoreWithToggleFullscreen() const
Whether minimising and restoring fullscreen windows uses ToggleFullscreen.
void ClientSizeChanged(int w, int h, bool force=false)
Indicate to the driver the client-size might have changed.
void MainLoop() override
Perform the actual drawing.
void ClaimMousePointer() override
Claim the exclusive rights for the mouse pointer.
Rect dirty_rect
Region of the screen that needs redrawing.
bool ToggleFullscreen(bool fullscreen) override
Change the full screen setting.
bool ChangeResolution(int w, int h) override
Change the resolution of the window.
The GDI video driver for windows.
std::string_view GetName() const override
Get the name of this driver.
void * buffer_bits
Internal rendering buffer.
HBITMAP dib_sect
System bitmap object referencing our rendering buffer.
void PaletteChanged(HWND hWnd) override
Palette of the window has changed.
std::optional< std::string_view > Start(const StringList ¶m) override
Start this driver.
void * GetVideoPointer() override
Get a pointer to the video buffer.
HPALETTE gdi_palette
Palette object for 8bpp blitter.
bool AllocateBackingStore(int w, int h, bool force=false) override
(Re-)create the backing store.
void Paint() override
Paint the window.
bool AfterBlitterChange() override
Callback invoked after the blitter was changed.
void Stop() override
Stop this driver.
virtual void PopulateSystemSprites()
Populate all sprites in cache.
virtual std::string_view GetInfoString() const
Get some information about the selected driver/backend to be shown to the user.
virtual void ClearSystemSprites()
Clear all cached sprites.
virtual bool UseSystemCursor()
Get whether the mouse cursor is drawn by the video driver.
const bool supports_animation_buffer
Whether this driver supports hardware accelerated animation.
virtual void ToggleVsync(bool vsync)
Change the vsync setting.
virtual bool AfterBlitterChange()
Callback invoked after the blitter was changed.
VideoDriver(bool uses_hardware_acceleration=false, bool supports_animation_buffer=false)
Create the video driver.
virtual bool HasEfficient8Bpp() const
Has this video driver an efficient code path for palette animated 8-bpp sprites?
virtual void Paint()
Paint the window.
const bool uses_hardware_acceleration
Whether hardware acceleration is used or not.
@ Driver
Driver message facility.
@ Video
Speed of painting drawn video buffer.
#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.