Merge branch 'fullscreen-api-nonrecreate' into dev
This commit is contained in:
commit
3a7f91cb07
7 changed files with 136 additions and 20 deletions
|
|
@ -98,28 +98,39 @@ void Display::setSize(unsigned int width, unsigned int height)
|
|||
|
||||
void Display::setVideoMode(Mode mode)
|
||||
{
|
||||
DisplayDescription desc;
|
||||
|
||||
if (m_fmode == mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode == FULLSCREEN || mode == WINDOWEDFULLSCREEN) {
|
||||
|
||||
// True fullscreen
|
||||
if (mode == FULLSCREEN) {
|
||||
desc.mode = m_description.mode;
|
||||
} else {
|
||||
desc.mode = DisplayMode::getDesktopMode();
|
||||
m_cacheDesc = m_description;
|
||||
}
|
||||
|
||||
desc.decoration = DisplayDecorate::None;
|
||||
} else {
|
||||
desc = m_cacheDesc;
|
||||
if (mode != FULLSCREEN) {
|
||||
m_impl->exitFullscreen();
|
||||
}
|
||||
|
||||
create(desc);
|
||||
// Cache window position when entering fullscreen.
|
||||
if (mode == FULLSCREEN || mode == WINDOWEDFULLSCREEN) {
|
||||
m_cachePos = m_impl->getPosition();
|
||||
}
|
||||
|
||||
// True fullscreen
|
||||
if (mode == FULLSCREEN) {
|
||||
m_impl->enterFullscreen(m_description.mode);
|
||||
}
|
||||
// Windowed fullscreen.
|
||||
else if (mode == WINDOWEDFULLSCREEN) {
|
||||
DisplayMode desktop = DisplayMode::getDesktopMode();
|
||||
m_impl->setDecoration(DisplayDecorate::None);
|
||||
m_impl->setSize(desktop.width, desktop.height);
|
||||
m_impl->setPosition(0, 0);
|
||||
}
|
||||
// Window mode.
|
||||
else {
|
||||
// Set stored decoration.
|
||||
m_impl->setDecoration(m_description.decoration);
|
||||
|
||||
// Restore size and position.
|
||||
m_impl->setSize(m_description.mode.width, m_description.mode.height);
|
||||
m_impl->setPosition(m_cachePos.x, m_cachePos.y);
|
||||
}
|
||||
|
||||
m_fmode = mode;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue