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
|
// Show the current FPS
|
||||||
void cInterfaceWGL::UpdateFPSDisplay(const std::string& text)
|
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.
|
// Create rendering window.
|
||||||
|
@ -68,14 +68,19 @@ bool cInterfaceWGL::Create(void *&window_handle)
|
||||||
if (window_handle == nullptr)
|
if (window_handle == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int _tx, _ty, _twidth, _theight;
|
HWND window_handle_reified = reinterpret_cast<HWND>(window_handle);
|
||||||
Host_GetRenderWindowSize(_tx, _ty, _twidth, _theight);
|
RECT window_rect = {0};
|
||||||
|
|
||||||
|
if (!GetClientRect(window_handle_reified, &window_rect))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Control window size and picture scaling
|
// Control window size and picture scaling
|
||||||
s_backbuffer_width = _twidth;
|
int twidth = (window_rect.right - window_rect.left);
|
||||||
s_backbuffer_height = _theight;
|
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
|
#ifdef _WIN32
|
||||||
dllHandle = LoadLibrary(TEXT("OpenGL32.dll"));
|
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
|
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.");
|
PanicAlert("(1) Can't create an OpenGL Device context. Fail.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -145,11 +150,11 @@ bool cInterfaceWGL::ClearCurrent()
|
||||||
void cInterfaceWGL::Update()
|
void cInterfaceWGL::Update()
|
||||||
{
|
{
|
||||||
RECT rcWindow;
|
RECT rcWindow;
|
||||||
GetClientRect((HWND)m_window_handle, &rcWindow);
|
GetClientRect(m_window_handle, &rcWindow);
|
||||||
|
|
||||||
// Get the new window width and height
|
// Get the new window width and height
|
||||||
s_backbuffer_width = rcWindow.right - rcWindow.left;
|
s_backbuffer_width = (rcWindow.right - rcWindow.left);
|
||||||
s_backbuffer_height = rcWindow.bottom - rcWindow.top;
|
s_backbuffer_height = (rcWindow.bottom - rcWindow.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close backend
|
// Close backend
|
||||||
|
@ -166,7 +171,7 @@ void cInterfaceWGL::Shutdown()
|
||||||
hRC = nullptr;
|
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.");
|
ERROR_LOG(VIDEO, "Attempt to release device context failed.");
|
||||||
hDC = nullptr;
|
hDC = nullptr;
|
||||||
|
|
|
@ -22,5 +22,5 @@ public:
|
||||||
void Update();
|
void Update();
|
||||||
bool PeekMessages();
|
bool PeekMessages();
|
||||||
|
|
||||||
void* m_window_handle;
|
HWND m_window_handle;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue