Jump to content

Full-screen while running


SpiderPig
 Share

Go to solution Solved by Josh,

Recommended Posts

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...

Link to comment
Share on other sites

  • Solution
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.

  • Thanks 1

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

Thanks.  Working now :D

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);
}

 

  • Upvote 2
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...