OpenTTD Source
20240919-master-gdf0233f4c2
|
Go to the documentation of this file.
15 #include <condition_variable>
33 bool ClaimMousePointer()
override;
60 bool MakeWindow(
bool full_screen,
bool resize =
true);
61 void ClientSizeChanged(
int w,
int h,
bool force =
false);
75 friend LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
82 std::optional<std::string_view>
Start(
const StringList ¶m)
override;
88 std::string_view
GetName()
const override {
return "win32"; }
95 void Paint()
override;
101 void UpdatePalette(HDC dc, uint start, uint count);
105 static int RedrawScreenDebug();
121 VideoDriver_Win32OpenGL() :
VideoDriver_Win32Base(true), dc(nullptr), gl_rc(nullptr), anim_buffer(nullptr), driver_info(this->GetName()) {}
123 std::optional<std::string_view>
Start(
const StringList ¶m)
override;
125 void Stop()
override;
140 uint8_t *
GetAnimBuffer()
override {
return this->anim_buffer; }
144 std::string_view
GetName()
const override {
return "win32-opengl"; }
146 std::string_view GetInfoString()
const override {
return this->driver_info; }
151 uint8_t *anim_buffer;
152 std::string driver_info;
156 void Paint()
override;
163 std::optional<std::string_view> AllocateContext();
164 void DestroyContext();
170 FVideoDriver_Win32OpenGL() :
DriverFactoryBase(
Driver::DT_VIDEO, 10,
"win32-opengl",
"Win32 OpenGL Video Driver") {}
virtual bool AllocateBackingStore(int w, int h, bool force=false)=0
(Re-)create the backing store.
void MainLoop() override
Perform the actual drawing.
virtual bool HasAnimBuffer()
Does this video driver support a separate animation buffer in addition to the colour buffer?
Base class for Windows video drivers.
The base of all video drivers.
Dimensions (a width and height) of a rectangle in 2D.
void Paint() override
Paint the window.
void EditBoxLostFocus() override
An edit box lost the input focus.
int width
Width in pixels of our display surface.
virtual void ReleaseVideoPointer()
Hand video buffer back to the painting backend.
DriverFactoryBase(Driver::Type type, int priority, const char *name, const char *description)
Construct a new DriverFactory.
bool PollEvent() override
Process a single system event.
virtual void ToggleVsync([[maybe_unused]] bool vsync)
Change the vsync setting.
virtual Driver * CreateInstance() const =0
Create an instance of this driver-class.
HWND main_wnd
Handle to system window.
bool buffer_locked
Video buffer was locked by the main thread.
bool AllocateBackingStore(int w, int h, bool force=false) override
(Re-)create the backing store.
Dimension GetScreenSize() const override
Get the resolution of the main screen.
int height_org
Original monitor resolution height, before we changed it.
int height
Height in pixels of our display surface.
virtual void ClearSystemSprites()
Clear all cached sprites.
void * buffer_bits
Internal rendering buffer.
HBITMAP dib_sect
System bitmap object referencing our rendering buffer.
void Stop() override
Stop this driver.
virtual void PaletteChanged(HWND hWnd)=0
Palette of the window has changed.
std::vector< int > GetListOfMonitorRefreshRates() override
Get a list of refresh rates of each available monitor.
void PaletteChanged(HWND hWnd) override
Palette of the window has changed.
virtual void Paint()
Paint the window.
std::string_view GetName() const override
Get the name of this driver.
void CheckPaletteAnim() override
Process any pending palette animation.
virtual uint8_t GetFullscreenBpp()
Get screen depth to use for fullscreen mode.
The factory for Windows' video driver.
virtual uint8_t * GetAnimBuffer()
Get a pointer to the animation buffer of the video back-end.
bool has_focus
Does our window have system focus?
std::vector< std::string > StringList
Type for a list of strings.
bool MakeWindow(bool full_screen, bool resize=true)
Instantiate a new window.
std::optional< std::string_view > Start(const StringList ¶m) override
Start this driver.
void Stop() override
Stop this driver.
bool ToggleFullscreen(bool fullscreen) override
Change the full screen setting.
void UnlockVideoBuffer() override
Unlock a previously locked video buffer.
virtual bool UseSystemCursor()
Get whether the mouse cursor is drawn by the video driver.
int width_org
Original monitor resolution width, before we changed it.
virtual void PopulateSystemSprites()
Populate all sprites in cache.
virtual std::optional< std::string_view > Start(const StringList &parm)=0
Start this driver.
virtual std::string_view GetName() const =0
Get the name of this driver.
bool fullscreen
Whether to use (true) fullscreen mode.
virtual void * GetVideoPointer()=0
Get a pointer to the video buffer.
@ DT_VIDEO
A video driver.
void MakeDirty(int left, int top, int width, int height) override
Mark a particular area dirty.
Driver * CreateInstance() const override
Create an instance of this driver-class.
virtual bool UsesHardwareAcceleration() const
Does the driver use hardware acceleration (video-drivers only).
bool LockVideoBuffer() override
Make sure the video buffer is ready for drawing.
The GDI video driver for windows.
Rect dirty_rect
Region of the screen that needs redrawing.
bool ChangeResolution(int w, int h) override
Change the resolution of the window.
bool AfterBlitterChange() override
Callback invoked after the blitter was changed.
virtual bool HasEfficient8Bpp() const
Has this video driver an efficient code path for palette animated 8-bpp sprites?
A driver for communicating with the user.
Specification of a rectangle with absolute coordinates of all edges.
float GetDPIScale() override
Get DPI scaling factor of the screen OTTD is displayed on.
void * GetVideoPointer() override
Get a pointer to the video buffer.
void InputLoop() override
Handle input logic, is CTRL pressed, should we fast-forward, etc.
Base for all driver factories.
virtual bool AfterBlitterChange()
Callback invoked after the blitter was changed.
HPALETTE gdi_palette
Palette object for 8bpp blitter.