SpiderPig Posted October 17, 2018 Share Posted October 17, 2018 Is it possible to change a window between full-screen and windowed mode while it is running? Can the full-screen window be created and then set as the default, then the old window deleted? ? Quote Link to comment Share on other sites More sharing options...
gamecreator Posted October 18, 2018 Share Posted October 18, 2018 Pretty sure you can. I've changed resolutions before so I can't see a reason why you can't also specify windows/full-screen. You may need to release the context first though. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted October 18, 2018 Author Share Posted October 18, 2018 Yeah I can change the resolution while it's running, but the only option I see for setting full-screen is in the Window::Create() function. I was looking for window->SetFullscreenMode(bool) or something similar. I'm wondering if releasing the window and recreating will cause problems... I should try it... Quote Link to comment Share on other sites More sharing options...
gamecreator Posted October 18, 2018 Share Posted October 18, 2018 Yeah, that's what I meant. What do you use to change the resolution? SetLayout? If so, how do you center the window (does it take the same argument Create does)? Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted October 18, 2018 Author Share Posted October 18, 2018 Ah okay. I use SetLayout and center the screen using (GetSystemMetrics(SM_CXSCREEN) / 2) - (newWidth / 2). SetLayout takes and x,y,width,and height arguments, but not a full screen argument. It would be nice if it did. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted October 18, 2018 Share Posted October 18, 2018 Agreed. Josh, I don't suppose you could make that a thing? It's very relevant when changing resolutions in-game. 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted October 18, 2018 Share Posted October 18, 2018 Create a new window and delete the old one. 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...
SpiderPig Posted October 18, 2018 Author Share Posted October 18, 2018 Will the old context also have to be remade to point to the new window? Quote Link to comment Share on other sites More sharing options...
Solution Josh Posted October 18, 2018 Solution Share Posted October 18, 2018 22 minutes ago, Lethal Raptor Games said: Will the old context also have to be remade to point to the new window? Nope, you create a new context on your new window. 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...
SpiderPig Posted October 18, 2018 Author Share Posted October 18, 2018 Thanks. Working now int _index = comboboxFullscreen->GetSelectedIndex(); bool _oldFullscreenValue = Base::Config::fullScreen; Base::Config::fullScreen = (_index == 0 ? true : false); if (_oldFullscreenValue != Base::Config::fullScreen) { Context::GetCurrent()->Release(); Window::GetCurrent()->Release(); int _xPos = (Base::Config::fullScreen == true ? 0 : Base::desktopWidth / 2); int _yPos = (Base::Config::fullScreen == true ? 0 : Base::desktopHeight / 2); auto _newWindow = Window::Create(Base::GameTitle, _xPos, _yPos, Base::Config::screenWidth, Base::Config::screenHeight, (Base::Config::fullScreen == true ? Window::FullScreen : Window::Titlebar)); auto _context = Context::Create(_newWindow); } else { Window::GetCurrent()->SetLayout((Base::desktopWidth / 2) - (Base::Config::screenWidth / 2), (Base::desktopHeight / 2) - (Base::Config::screenHeight / 2), Base::Config::screenWidth, Base::Config::screenHeight); } 2 Quote Link to comment Share on other sites More sharing options...
Josh Posted October 18, 2018 Share Posted October 18, 2018 I'm going to give myself the trophy but it means a lot more when the OP gives it to me. 1 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...
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.