NightQuest Posted March 8, 2015 Share Posted March 8, 2015 We have Window::setLayout which is awesome for resizing.. but what if we want borderless window? Right now, I'm using this platform-specific code for that: if( window->KeyHit(Key::F11) ) { int screenWidth = GetSystemMetrics(SM_CXSCREEN); int screenHeight = GetSystemMetrics(SM_CYSCREEN); if( fullscreen ) { long style = reinterpret_cast<long>(window->GetUserData()); SetWindowLongPtr(window->hwnd, GWL_STYLE, style); int width = stoi(System::GetProperty("width", "1280")); int height = stoi(System::GetProperty("height", "720")); window->SetLayout((screenWidth - width) / 2, (screenHeight - height) / 2, width, height); } else { long style = GetWindowLongPtr(window->hwnd, GWL_STYLE); window->SetUserData(reinterpret_cast<void*>(style)); SetWindowLongPtr(window->hwnd, GWL_STYLE, style & ~(WS_BORDER | WS_OVERLAPPEDWINDOW)); window->SetLayout(0, 0, screenWidth, screenHeight); } fullscreen = !fullscreen; } This would allow us to simply do: if( window->KeyHit(Key::F11) ) { fullscreen = !fullscreen; int width = fullscreen ? GetSystemMetrics(SM_CXSCREEN) : stoi(System::GetProperty("width", "1280")); int height = fullscreen ? GetSystemMetrics(SM_CYSCREEN) : stoi(System::GetProperty("height", "720")); int style = Window::Center; if( fullscreen ) style &= ~Window::Titlebar; else style |= Window::Titlebar; window->setStyle(style); window->setLayout(0, 0, width, height); } And maybe we could get a Vec2 System::GetCurrentMonitorResolution(); or something to retrieve the current monitors display resolution? While I don't mind the Win32API, I'd like to be able to easily do these things on both platforms. GTK+ has gtk-window-set-decorated, and X11 has DefaultScreenOfDisplay. 1 Quote Link to comment Share on other sites More sharing options...
reepblue Posted March 8, 2015 Share Posted March 8, 2015 Yeah, this would be nice to see. Definitely the idea of a simple GetCurrentMonitorResolution function as it will make fullscreen mode properly set, and it will always look right with no need for config files. It would also be really great to have for lua games as well. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted March 8, 2015 Share Posted March 8, 2015 See System class: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/system/systemcountgraphicsmodes-r857 http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/system/systemgetgraphicsmode-r858 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
NightQuest Posted March 8, 2015 Author Share Posted March 8, 2015 Those are awesome, but they do not give you the current displaymode - maybe a int System::GetCurrentGraphicsMode()? Quote Link to comment Share on other sites More sharing options...
Josh Posted March 8, 2015 Share Posted March 8, 2015 It would be an extremely rare case for the system to not already be running at the maximum resolution. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
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.