Jump to content

Full-screen while running


Go to solution Solved by Josh,

Recommended Posts

Posted

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

Posted

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.

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

Let's build cool stuff and have fun. :)

Posted

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

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.

×
×
  • Create New...