diff --git a/src/win32/win32gliface.cpp b/src/win32/win32gliface.cpp index 1223da838..48de9e8e0 100644 --- a/src/win32/win32gliface.cpp +++ b/src/win32/win32gliface.cpp @@ -26,6 +26,9 @@ #include "gl/renderer/gl_renderer.h" #include "gl/system/gl_framebuffer.h" +extern HWND Window; +extern BOOL AppActive; + extern "C" { _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; @@ -50,6 +53,77 @@ CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINI EXTERN_CVAR(Bool, vr_enable_quadbuffered) EXTERN_CVAR(Int, vid_refreshrate) + +//========================================================================== +// +// +// +//========================================================================== + +class Win32GLVideo : public IVideo +{ +public: + Win32GLVideo(int parm); + virtual ~Win32GLVideo(); + + EDisplayType GetDisplayType() { return DISPLAY_Both; } + void SetWindowedScale(float scale); + void StartModeIterator(int bits, bool fs); + bool NextMode(int *width, int *height, bool *letterbox); + bool GoFullscreen(bool yes); + DFrameBuffer *CreateFrameBuffer(int width, int height, bool fs, DFrameBuffer *old); + virtual bool SetResolution(int width, int height, int bits); + void DumpAdapters(); + bool InitHardware(HWND Window, int multisample); + void Shutdown(); + bool SetFullscreen(const char *devicename, int w, int h, int bits, int hz); + + HDC m_hDC; + +protected: + struct ModeInfo + { + ModeInfo(int inX, int inY, int inBits, int inRealY, int inRefresh) + : next(NULL), + width(inX), + height(inY), + bits(inBits), + refreshHz(inRefresh), + realheight(inRealY) + {} + ModeInfo *next; + int width, height, bits, refreshHz, realheight; + } *m_Modes; + + ModeInfo *m_IteratorMode; + int m_IteratorBits; + bool m_IteratorFS; + bool m_IsFullscreen; + int m_trueHeight; + int m_DisplayWidth, m_DisplayHeight, m_DisplayBits, m_DisplayHz; + HMODULE hmRender; + + char m_DisplayDeviceBuffer[CCHDEVICENAME]; + char *m_DisplayDeviceName; + HMONITOR m_hMonitor; + + HWND m_Window; + HGLRC m_hRC; + + HWND InitDummy(); + void ShutdownDummy(HWND dummy); + bool SetPixelFormat(); + bool SetupPixelFormat(int multisample); + + void GetDisplayDeviceName(); + void MakeModesList(); + void AddMode(int x, int y, int bits, int baseHeight, int refreshHz); + void FreeModes(); +public: + int GetTrueHeight() { return m_trueHeight; } + +}; + //========================================================================== // // @@ -1161,6 +1235,11 @@ int Win32GLFrameBuffer::GetClientHeight() return rect.bottom - rect.top; } +int Win32GLFrameBuffer::GetTrueHeight() +{ + return static_cast(Video)->GetTrueHeight(); +} + IVideo *gl_CreateVideo() { return new Win32GLVideo(0); diff --git a/src/win32/win32gliface.h b/src/win32/win32gliface.h index b5855668c..463220a99 100644 --- a/src/win32/win32gliface.h +++ b/src/win32/win32gliface.h @@ -27,71 +27,6 @@ struct FRenderer; FRenderer *gl_CreateInterface(); -class Win32GLVideo : public IVideo -{ -public: - Win32GLVideo(int parm); - virtual ~Win32GLVideo(); - - EDisplayType GetDisplayType () { return DISPLAY_Both; } - void SetWindowedScale (float scale); - void StartModeIterator (int bits, bool fs); - bool NextMode (int *width, int *height, bool *letterbox); - bool GoFullscreen(bool yes); - DFrameBuffer *CreateFrameBuffer (int width, int height, bool fs, DFrameBuffer *old); - virtual bool SetResolution (int width, int height, int bits); - void DumpAdapters(); - bool InitHardware (HWND Window, int multisample); - void Shutdown(); - bool SetFullscreen(const char *devicename, int w, int h, int bits, int hz); - - HDC m_hDC; - -protected: - struct ModeInfo - { - ModeInfo (int inX, int inY, int inBits, int inRealY, int inRefresh) - : next (NULL), - width (inX), - height (inY), - bits (inBits), - refreshHz (inRefresh), - realheight (inRealY) - {} - ModeInfo *next; - int width, height, bits, refreshHz, realheight; - } *m_Modes; - - ModeInfo *m_IteratorMode; - int m_IteratorBits; - bool m_IteratorFS; - bool m_IsFullscreen; - int m_trueHeight; - int m_DisplayWidth, m_DisplayHeight, m_DisplayBits, m_DisplayHz; - HMODULE hmRender; - - char m_DisplayDeviceBuffer[CCHDEVICENAME]; - char *m_DisplayDeviceName; - HMONITOR m_hMonitor; - - HWND m_Window; - HGLRC m_hRC; - - HWND InitDummy(); - void ShutdownDummy(HWND dummy); - bool SetPixelFormat(); - bool SetupPixelFormat(int multisample); - - void GetDisplayDeviceName(); - void MakeModesList(); - void AddMode(int x, int y, int bits, int baseHeight, int refreshHz); - void FreeModes(); -public: - int GetTrueHeight() { return m_trueHeight; } - -}; - - class Win32GLFrameBuffer : public BaseWinFB { @@ -120,7 +55,7 @@ public: int GetClientWidth(); int GetClientHeight(); - int GetTrueHeight() { return static_cast(Video)->GetTrueHeight(); } + int GetTrueHeight(); bool Lock(bool buffered); bool Lock ();