|
@@ -12,12 +12,14 @@
|
|
|
|
|
|
#include "video_driver.hpp"
|
|
|
|
|
|
/** Base class for Windows video drivers. */
|
|
|
class VideoDriver_Win32Base : public VideoDriver {
|
|
|
public:
|
|
|
VideoDriver_Win32Base() : main_wnd(nullptr) {}
|
|
|
|
|
|
void MakeDirty(int left, int top, int width, int height) override;
|
|
|
|
|
|
void MainLoop() override;
|
|
|
|
|
|
bool ChangeResolution(int w, int h) override;
|
|
|
|
|
@@ -29,12 +31,14 @@ public:
|
|
|
|
|
|
bool ClaimMousePointer() override;
|
|
|
|
|
|
void EditBoxLostFocus() override;
|
|
|
|
|
|
protected:
|
|
|
HWND main_wnd; ///< Handle to system window.
|
|
|
|
|
|
Dimension GetScreenSize() const override;
|
|
|
float GetDPIScale() override;
|
|
|
void InputLoop() override;
|
|
|
bool LockVideoBuffer() override;
|
|
|
void UnlockVideoBuffer() override;
|
|
|
void CheckPaletteAnim() override;
|
|
@@ -55,26 +59,38 @@ private:
|
|
|
|
|
|
friend LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
|
};
|
|
|
/** The GDI video driver for windows. */
|
|
|
class VideoDriver_Win32GDI : public VideoDriver_Win32Base {
|
|
|
public:
|
|
|
VideoDriver_Win32GDI() : dib_sect(nullptr), gdi_palette(nullptr) {}
|
|
|
|
|
|
const char *Start(const StringList ¶m) override;
|
|
|
|
|
|
void Stop() override;
|
|
|
|
|
|
bool AfterBlitterChange() override;
|
|
|
|
|
|
const char *GetName() const override { return "win32"; }
|
|
|
|
|
|
protected:
|
|
|
HBITMAP dib_sect; ///< System bitmap object referencing our rendering buffer.
|
|
|
HPALETTE gdi_palette; ///< Palette object for 8bpp blitter.
|
|
|
|
|
|
void Paint() override;
|
|
|
void PaintThread() override;
|
|
|
|
|
|
bool AllocateBackingStore(int w, int h, bool force = false) override;
|
|
|
void PaletteChanged(HWND hWnd) override;
|
|
|
void MakePalette();
|
|
|
void UpdatePalette(HDC dc, uint start, uint count);
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
public:
|
|
|
static int RedrawScreenDebug();
|
|
|
#endif
|
|
|
};
|
|
|
|
|
|
/** The factory for Windows' video driver. */
|
|
|
class FVideoDriver_Win32GDI : public DriverFactoryBase {
|
|
|
public:
|
|
|
FVideoDriver_Win32GDI() : DriverFactoryBase(Driver::DT_VIDEO, 10, "win32", "Win32 GDI Video Driver") {}
|