Commit d6975872 authored by cutealien's avatar cutealien

Implement setWindowSize for Win32 device.

Note about implementation: There is already IVideoDriver::getScreenSize() which is more or less the getter for this function. But I don't think it belongs in IVideoDriver and also this function is about the window and not the screen obviously. So might make sense adding getWindowSize and deprecating getScreenSize, but that needs further changes in GUI. For now I just added a comment and let the rest be as it was.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4693 dfc29bdd-3216-0410-991c-e03cc46cb475
parent d6f70292
......@@ -230,6 +230,7 @@ namespace irr
//! Resize the render window.
/** This will only work in windowed mode and is not yet supported on all systems.
It does set the drawing/clientDC size of the window, the window decorations are added to that.
You get the current window size with IVideoDriver::getScreenSize() (might be unified in future)
*/
virtual void setWindowSize(const irr::core::dimension2d<u32>& size) = 0;
......
......@@ -1670,6 +1670,28 @@ void CIrrDeviceWin32::OnResized()
Resized = true;
}
//! Resize the render window.
void CIrrDeviceWin32::setWindowSize(const irr::core::dimension2d<u32>& size)
{
if (ExternalWindow || !getVideoDriver() || CreationParams.Fullscreen)
return;
// get size of the window for the give size of the client area
LONG_PTR style = GetWindowLongPtr(HWnd, GWL_STYLE);
LONG_PTR exStyle = GetWindowLongPtr(HWnd, GWL_EXSTYLE);
RECT clientSize;
clientSize.top = 0;
clientSize.left = 0;
clientSize.right = size.Width;
clientSize.bottom = size.Height;
AdjustWindowRectEx(&clientSize, style, false, exStyle);
const s32 realWidth = clientSize.right - clientSize.left;
const s32 realHeight = clientSize.bottom - clientSize.top;
UINT flags = SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOZORDER;
SetWindowPos(HWnd, HWND_TOP, 0, 0, realWidth, realHeight, flags);
}
//! Sets if the window should be resizable in windowed mode.
void CIrrDeviceWin32::setResizable(bool resize)
{
......
......@@ -77,6 +77,9 @@ namespace irr
//! Sets if the window should be resizable in windowed mode.
virtual void setResizable(bool resize=false) _IRR_OVERRIDE_;
//! Resize the render window.
virtual void setWindowSize(const irr::core::dimension2d<u32>& size) _IRR_OVERRIDE_;
//! Minimizes the window.
virtual void minimizeWindow() _IRR_OVERRIDE_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment