OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
15 #include <condition_variable>
36 bool ClaimMousePointer()
override;
67 void ClientSizeChanged(
int w,
int h,
bool force =
false);
81 std::unique_lock<std::recursive_mutex> draw_lock;
85 friend LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
98 const char *
GetName()
const override {
return "win32"; }
105 void Paint()
override;
112 void UpdatePalette(HDC dc, uint start, uint count);
116 static int RedrawScreenDebug();
132 VideoDriver_Win32OpenGL() : dc(nullptr), gl_rc(nullptr), anim_buffer(nullptr) {}
136 void Stop()
override;
149 uint8 *
GetAnimBuffer()
override {
return this->anim_buffer; }
151 const char *
GetName()
const override {
return "win32-opengl"; }
161 void Paint()
override;
169 const char *AllocateContext();
170 void DestroyContext();
176 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.
virtual const char * GetName() const =0
Get the name of this driver.
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.
bool draw_threaded
Whether the drawing is/may be done in a separate thread.
std::condition_variable_any * draw_signal
Signal to draw the next frame.
virtual Driver * CreateInstance() const =0
Create an instance of this driver-class.
std::recursive_mutex * draw_mutex
Mutex to keep the access to the shared memory controlled.
HWND main_wnd
Handle to system window.
void AcquireBlitterLock() override
Acquire any lock(s) required to be held when changing blitters.
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.
void PaletteChanged(HWND hWnd) override
Palette of the window has changed.
virtual void Paint()
Paint the window.
const char * GetName() const override
Get the name of this driver.
virtual const char * Start(const StringList &parm)=0
Start this driver.
void CheckPaletteAnim() override
Process any pending palette animation.
The factory for Windows' video driver.
bool has_focus
Does our window have system focus?
std::vector< std::string > StringList
Type for a list of strings.
virtual uint8 GetFullscreenBpp()
Get screen depth to use for fullscreen mode.
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 uint8 * GetAnimBuffer()
Get a pointer to the animation buffer of the video back-end.
virtual bool UseSystemCursor()
Get whether the mouse cursor is drawn by the video driver.
virtual void PaintThread()
Thread function for threaded drawing.
int width_org
Original monitor resolution width, before we changed it.
void ReleaseBlitterLock() override
Release any lock(s) required to be held when changing blitters.
const char * Start(const StringList ¶m) override
Start 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.
volatile bool draw_continue
Should we keep continue drawing?
Driver * CreateInstance() const override
Create an instance of this driver-class.
bool LockVideoBuffer() override
Make sure the video buffer is ready for drawing.
bool MakeWindow(bool full_screen)
Instantiate a new window.
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?
void PaintThread() override
Thread function for threaded drawing.
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.