void Window::ValidateVideoMode( sf::VideoMode &video_mode ) { if ( video_mode.IsValid() ) return; // Set the video mode to the smallest video mode the screen can handle. video_mode = video_mode.GetFullscreenModes().back(); }
void App::validateVideoMode(sf::VideoMode& mode) { if (mode.width > 1920) mode.width = 1920; else if (mode.width < 800) mode.width = 800; if (mode.height > 1080) mode.height = 1080; else if (mode.height < 600) mode.height = 600; if (m_fullscreen && mode.isValid()) { const std::vector<sf::VideoMode>& fullscreen_modes = sf::VideoMode::getFullscreenModes(); for (std::size_t i = 1; i < fullscreen_modes.size(); i++) { if (fullscreen_modes[i].width < mode.width && fullscreen_modes[i].height < mode.height && fullscreen_modes[i - 1].width <= 1920 && fullscreen_modes[i - 1].height <= 1080) { mode = fullscreen_modes[i - 1]; break; } } } }
// // Video / Window Settings void pwEngineOptions::SetVideoMode(const sf::VideoMode& VideoMode) { if (myEngineSettings.VideoMode == VideoMode) return; myChanged = true; if ((myEngineSettings.WindowStyle & sf::Style::Fullscreen) == sf::Style::Fullscreen && !VideoMode.isValid()) { pwLog::get()->WriteLine("pwEngineOptions::SetVideoMode: Setting an invalid VideoMode while being in fullscreen. [nothing is changed]", pwLogType::pwLTCaution); return; } bool TmpBool = pwGraphics::get()->Shutdown(); myEngineSettings.VideoMode = VideoMode; if (TmpBool) { pwGraphics::get()->Initialize(); } }