MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / DisplayDropdown

Method DisplayDropdown

src/openrct2-ui/windows/Options.cpp:914–983  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

912 }
913
914 void DisplayDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex)
915 {
916 switch (widgetIndex)
917 {
918 case WIDX_RESOLUTION_DROPDOWN:
919 {
920 const auto& resolutions = GetContext()->GetUiContext().GetFullscreenResolutions();
921
922 const Resolution& resolution = resolutions[dropdownIndex];
923 if (resolution.Width != Config::Get().general.fullscreenWidth
924 || resolution.Height != Config::Get().general.fullscreenHeight)
925 {
926 Config::Get().general.fullscreenWidth = resolution.Width;
927 Config::Get().general.fullscreenHeight = resolution.Height;
928
929 if (Config::Get().general.fullscreenMode == static_cast<int32_t>(FullscreenMode::fullscreen))
930 ContextSetFullscreenMode(static_cast<int32_t>(FullscreenMode::fullscreen));
931
932 Config::Save();
933 GfxInvalidateScreen();
934 }
935 break;
936 }
937 case WIDX_FULLSCREEN_DROPDOWN:
938 if (dropdownIndex != Config::Get().general.fullscreenMode)
939 {
940 ContextSetFullscreenMode(dropdownIndex);
941
942 Config::Get().general.fullscreenMode = static_cast<uint8_t>(dropdownIndex);
943 Config::Save();
944 GfxInvalidateScreen();
945 }
946 break;
947 case WIDX_DRAWING_ENGINE_DROPDOWN:
948 if (dropdownIndex != EnumValue(Config::Get().general.drawingEngine))
949 {
950 DrawingEngine dstEngine = static_cast<DrawingEngine>(dropdownIndex);
951
952 Config::Get().general.drawingEngine = dstEngine;
953 RefreshVideo();
954 Config::Save();
955 invalidate();
956 }
957 break;
958 case WIDX_FRAME_RATE_LIMIT_DROPDOWN:
959 {
960 auto& config = Config::Get().general;
961 switch (dropdownIndex)
962 {
963 case 0: // vanilla
964 config.uncapFPS = false;
965 config.useVSync = false;
966 break;
967 case 1: // vsync
968 config.uncapFPS = true;
969 config.useVSync = true;
970 break;
971 case 2: // uncapped

Callers

nothing calls this directly

Calls 8

GetContextFunction · 0.85
ContextSetFullscreenModeFunction · 0.85
SaveFunction · 0.85
GfxInvalidateScreenFunction · 0.85
EnumValueFunction · 0.85
RefreshVideoFunction · 0.85
DrawingEngineSetVSyncFunction · 0.85
invalidateFunction · 0.50

Tested by

no test coverage detected