WGL: Get rid of the use of the Host_GetRenderWindowSize() call.
Just use the Windows API to accomplish the same thing (this is what is done in Update()). This makes the backing window handle the correct data-type for Windows for easier use in function calls.
This commit is contained in:
parent
2b341bb267
commit
df67a18c42
|
@ -58,7 +58,7 @@ bool cInterfaceWGL::PeekMessages()
|
|||
// Show the current FPS
|
||||
void cInterfaceWGL::UpdateFPSDisplay(const std::string& text)
|
||||
{
|
||||
SetWindowTextA((HWND)m_window_handle, text.c_str());
|
||||
SetWindowTextA(m_window_handle, text.c_str());
|
||||
}
|
||||
|
||||
// Create rendering window.
|
||||
|
@ -68,14 +68,19 @@ bool cInterfaceWGL::Create(void *&window_handle)
|
|||
if (window_handle == nullptr)
|
||||
return false;
|
||||
|
||||
int _tx, _ty, _twidth, _theight;
|
||||
Host_GetRenderWindowSize(_tx, _ty, _twidth, _theight);
|
||||
HWND window_handle_reified = reinterpret_cast<HWND>(window_handle);
|
||||
RECT window_rect = {0};
|
||||
|
||||
if (!GetClientRect(window_handle_reified, &window_rect))
|
||||
return false;
|
||||
|
||||
// Control window size and picture scaling
|
||||
s_backbuffer_width = _twidth;
|
||||
s_backbuffer_height = _theight;
|
||||
int twidth = (window_rect.right - window_rect.left);
|
||||
int theight = (window_rect.bottom - window_rect.top);
|
||||
s_backbuffer_width = twidth;
|
||||
s_backbuffer_height = theight;
|
||||
|
||||
m_window_handle = window_handle;
|
||||
m_window_handle = window_handle_reified;
|
||||
|
||||
#ifdef _WIN32
|
||||
dllHandle = LoadLibrary(TEXT("OpenGL32.dll"));
|
||||
|
@ -105,7 +110,7 @@ bool cInterfaceWGL::Create(void *&window_handle)
|
|||
|
||||
int PixelFormat; // Holds The Results After Searching For A Match
|
||||
|
||||
if (!(hDC = GetDC((HWND)window_handle))) {
|
||||
if (!(hDC = GetDC(window_handle_reified))) {
|
||||
PanicAlert("(1) Can't create an OpenGL Device context. Fail.");
|
||||
return false;
|
||||
}
|
||||
|
@ -145,11 +150,11 @@ bool cInterfaceWGL::ClearCurrent()
|
|||
void cInterfaceWGL::Update()
|
||||
{
|
||||
RECT rcWindow;
|
||||
GetClientRect((HWND)m_window_handle, &rcWindow);
|
||||
GetClientRect(m_window_handle, &rcWindow);
|
||||
|
||||
// Get the new window width and height
|
||||
s_backbuffer_width = rcWindow.right - rcWindow.left;
|
||||
s_backbuffer_height = rcWindow.bottom - rcWindow.top;
|
||||
s_backbuffer_width = (rcWindow.right - rcWindow.left);
|
||||
s_backbuffer_height = (rcWindow.bottom - rcWindow.top);
|
||||
}
|
||||
|
||||
// Close backend
|
||||
|
@ -166,7 +171,7 @@ void cInterfaceWGL::Shutdown()
|
|||
hRC = nullptr;
|
||||
}
|
||||
|
||||
if (hDC && !ReleaseDC((HWND)m_window_handle, hDC))
|
||||
if (hDC && !ReleaseDC(m_window_handle, hDC))
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Attempt to release device context failed.");
|
||||
hDC = nullptr;
|
||||
|
|
|
@ -22,5 +22,5 @@ public:
|
|||
void Update();
|
||||
bool PeekMessages();
|
||||
|
||||
void* m_window_handle;
|
||||
HWND m_window_handle;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue