bandrewk Posted February 27, 2014 Posted February 27, 2014 Hello, Leadwerks is not creating correctly sized windows. When setting the resolution to 800 x 600: window = Window::Create("UISystem", 0, 0, 800, 600); A window with the window size of 800 x 600 will be created, it seems correct at first but what I really wanted (and expected) this command to do is create a client area with the size of 800 x 600. Leadwerks behavior: Expected behavior: Thank you. Quote
gamecreator Posted February 27, 2014 Posted February 27, 2014 http://www.leadwerks.com/werkspace/topic/7649-windowed-programs-are-incorrect-size/ Quote
bandrewk Posted February 27, 2014 Author Posted February 27, 2014 This is a difficult situation because with Aero Microsoft broke the functionality of the Windows API to create a window of a specific size. Really. There's a bug report somewhere on this forum with a link to their actual documentation explaining this. That's complete nonsense. Just use the AdjustWindowRect Windows API function. I fixed a related bug on another engine with the code below. //Window rectW.left = GetSystemMetrics(SM_CXSCREEN)/2 - nScreenWidth/2; rectW.top = GetSystemMetrics(SM_CYSCREEN)/2 - nScreenHeight/2; rectW.right = rectW.left + nScreenWidth; rectW.bottom = rectW.top + nScreenHeight; styleW = WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_VISIBLE; //WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX; AdjustWindowRect(&rectW,styleW,false); Quote
Josh Posted March 1, 2014 Posted March 1, 2014 That's complete nonsense. Just use the AdjustWindowRect Windows API function. I fixed a related bug on another engine with the code below. //Window rectW.left = GetSystemMetrics(SM_CXSCREEN)/2 - nScreenWidth/2; rectW.top = GetSystemMetrics(SM_CYSCREEN)/2 - nScreenHeight/2; rectW.right = rectW.left + nScreenWidth; rectW.bottom = rectW.top + nScreenHeight; styleW = WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_VISIBLE; //WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX; AdjustWindowRect(&rectW,styleW,false); Well, that's still not the right behavior. That creates a window with a specific client size. The Leadwerks function Windows::Create() is designed to create a window with a specified outer size. Which Windows can't actually do precisely, and it is a known bug in Aero. (Not sure if this is the same bug, but it probably is):http://connect.microsoft.com/VisualStudio/feedback/details/758042/visual-studio-2012-app-window-size-behaviour-differ-from-previous-vs-versions-window-creation Since this is asking for new functionality different from the intended behavior, this is a feature request, not a bug report. It's probably a good idea to add an additional creation flag like Window::ClientCoords in the future, so that the function behaves in the way the OP suggested. In the meantime, calling Context:GetWidth()/GetHeight() will return the correct client dimensions. Quote My job is to make tools you love, with the features you want, and performance you can't live without.
bandrewk Posted March 2, 2014 Author Posted March 2, 2014 Alright, looking forward to that new functionality then. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.