diff options
| author | Lioncash <mathew1800@gmail.com> | 2014-08-09 00:50:14 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2014-08-09 00:50:14 -0400 |
| commit | e266635f404bd59bb9d93ad34492ea33d236ae6a (patch) | |
| tree | 2b6b38418c1f2390a98f89a0680ad8b6cc1335cd /Source/Core/DolphinWX/GLInterface/WGL.cpp | |
| parent | 907e0d094fd9fe396018c57e5fce3937d951af13 (diff) | |
| parent | dc2bc621a4ab405671568c831e8228ad94aaf565 (diff) | |
Merge pull request #740 from lioncash/host
Core: Kill off a few Host interface functions.
Diffstat (limited to 'Source/Core/DolphinWX/GLInterface/WGL.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/GLInterface/WGL.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/Source/Core/DolphinWX/GLInterface/WGL.cpp b/Source/Core/DolphinWX/GLInterface/WGL.cpp index 94bc0e3c36..39e18f9105 100644 --- a/Source/Core/DolphinWX/GLInterface/WGL.cpp +++ b/Source/Core/DolphinWX/GLInterface/WGL.cpp @@ -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; |
