| 1424 | }; |
| 1425 | |
| 1426 | VideoMenu::VideoMenu( MenuBase* parent, const Sound::SoundEnginePtr& sound_engine, HostCommands& host_commands ) |
| 1427 | : MenuBase( parent, sound_engine ) |
| 1428 | , host_commands_(host_commands) |
| 1429 | , settings_(host_commands.GetSettings()) |
| 1430 | { |
| 1431 | const SystemWindow* system_window= host_commands.GetSystemWindow(); |
| 1432 | if( system_window != nullptr ) |
| 1433 | video_modes_= system_window->GetSupportedVideoModes(); |
| 1434 | |
| 1435 | settings_.GetOrSetBool( SettingsKeys::fullscreen, false ); |
| 1436 | |
| 1437 | display_= std::max( 0, std::min( settings_.GetOrSetInt( SettingsKeys::fullscreen_display, 0 ), int(video_modes_.size()) ) ); |
| 1438 | |
| 1439 | const int width = settings_.GetInt( SettingsKeys::fullscreen_width ); |
| 1440 | const int height= settings_.GetInt( SettingsKeys::fullscreen_height ); |
| 1441 | const int frequency= settings_.GetInt( SettingsKeys::fullscreen_frequency ); |
| 1442 | if( !video_modes_.empty() ) |
| 1443 | { |
| 1444 | const SystemWindow::VideoModes& display_modes= video_modes_[display_]; |
| 1445 | for( unsigned int i= 0u; i < display_modes.size(); i++ ) |
| 1446 | { |
| 1447 | if( width == int(display_modes[i].size.Width()) && height == int(display_modes[i].size.Height()) ) |
| 1448 | { |
| 1449 | resolution_= i; |
| 1450 | for( unsigned int j= 0u; j < display_modes[i].supported_frequencies.size(); j++ ) |
| 1451 | { |
| 1452 | if( int(display_modes[i].supported_frequencies[j]) == frequency ) |
| 1453 | { |
| 1454 | frequency_= j; |
| 1455 | break; |
| 1456 | } |
| 1457 | } |
| 1458 | break; |
| 1459 | } |
| 1460 | } |
| 1461 | } |
| 1462 | |
| 1463 | std::snprintf( window_width_ , sizeof(window_width_ ), "%d", settings_.GetInt( SettingsKeys::window_width ) ); |
| 1464 | std::snprintf( window_height_, sizeof(window_height_), "%d", settings_.GetInt( SettingsKeys::window_height ) ); |
| 1465 | } |
| 1466 | |
| 1467 | VideoMenu::~VideoMenu() |
| 1468 | {} |
nothing calls this directly
no test coverage detected