bool ScreenMode::operator <(const ScreenMode& rhs) const { //sort by fullscreen first if (!isFullScreen() && rhs.isFullScreen()){ return true; } else if (isFullScreen() && !rhs.isFullScreen()){ return false; } //next by bpp if (m_bpp < rhs.getBPP()){ return true; } else if (m_bpp > rhs.getBPP()){ return false; } //then by screen dimentions if (m_width == rhs.getWidth() && m_height == rhs.getHeight()){ if (!(m_SDLFlags & SDL_HWSURFACE) && (rhs.getSDLFlags() & SDL_HWSURFACE)) { //I would like return true so that we prefer hardware surfaces but //it really slows the engine down in fullscreen. See the SDL FAQ for an //explanation. return false; } } else if (m_width < rhs.getWidth() || m_height < rhs.getHeight()) { return true; } return false; }
void Engine::changeScreenMode(const ScreenMode& mode){ m_cursor->invalidate(); m_imagemanager->invalidateAll(); m_renderbackend->setScreenMode(mode); if (m_guimanager) { m_guimanager->resizeTopContainer(0,0,mode.getWidth(), mode.getHeight()); } std::vector<IEngineChangeListener*>::iterator i = m_changelisteners.begin(); while (i != m_changelisteners.end()) { (*i)->onScreenModeChanged(mode); ++i; } }
ScreenMode::ScreenMode(const ScreenMode& rhs){ m_width = rhs.getWidth(); m_height = rhs.getHeight(); m_bpp = rhs.getBPP(); m_SDLFlags = rhs.getSDLFlags(); }