MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / DrawVideoOptionsMenu

Function DrawVideoOptionsMenu

neo/framework/Dhewm3SettingsMenu.cpp:1864–2071  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1862}
1863
1864static void DrawVideoOptionsMenu()
1865{
1866 ImGui::Spacing();
1867 ImGui::Combo( "##qualPresets", &qualityPreset, "Low Quality\0Medium Quality\0High Quality\0Ultra Quality\0" );
1868 AddTooltip( "com_machineSpec" );
1869 ImGui::SameLine();
1870 if ( ImGui::Button( "Load Quality Preset" ) ) {
1871 com_machineSpec.SetInteger( qualityPreset ); // TODO: or always set this even if button is not pressed?
1872 // execMachineSpec might change the MSAA value, so remember the old one (that's currently used)
1873 const int oldMSAA = r_multiSamples.GetInteger();
1874 cmdSystem->BufferCommandText( CMD_EXEC_NOW, "execMachineSpec nores\n" );
1875
1876 if ( oldMSAA > 0 && qualityPreset >= 2 ) {
1877 // the user already changed the MSAA at some point, and chose High or Ultra Quality,
1878 // which both set MSAA to 0 - restore users setting
1879 r_multiSamples.SetInteger( oldMSAA );
1880 }
1881 }
1882 AddTooltip( "Sets lots of rendering-related CVars based on the selected quality" );
1883
1884 ImGui::SeparatorText( "Options that must be applied" );
1885
1886 // fullscreen
1887 int fullscreenChoice = r_fullscreen.GetBool();
1888 if ( ImGui::Combo( "Window Mode", &fullscreenChoice, "Windowed\0Fullscreen\0" ) ) {
1889 r_fullscreen.SetBool( fullscreenChoice != 0 );
1890 }
1891 AddTooltip( "r_fullscreen" );
1892 bool fullscreenDesktop = r_fullscreenDesktop.GetBool();
1893 if ( ImGui::Checkbox( "Fullscreen Desktop Mode: Use borderless window at desktop resolution for fullscreen", &fullscreenDesktop ) ) {
1894 r_fullscreenDesktop.SetBool( fullscreenDesktop );
1895 }
1896 AddTooltip( "r_fullscreenDesktop" );
1897 AddDescrTooltip( "ignores the resolution configured in dhewm3, doesn't switch the display resolution, can prevent issues like desktop icons being rearranged after running the game" );
1898
1899 // Video Mode / Resolution
1900 static int selModeIdx = -1; // index within our vidModes array
1901 static int selMode = -3; // global mode number (as used in r_mode)
1902 int curMode = r_mode.GetInteger();
1903 if ( selMode != curMode ) {
1904 selMode = curMode;
1905 int w, h;
1906 if ( !R_GetModeInfo( &w, &h, curMode ) ) {
1907 // invalid mode
1908 selMode = (curMode < 0) ? -1 : 4; // safe default (800x600)
1909 r_mode.SetInteger( selMode );
1910 }
1911 selModeIdx = 0; // set *something* in case it's not found below
1912 for ( int i=0, n=vidModes.Num(); i < n; ++i ) {
1913 if ( vidModes[i].mode == selMode ) {
1914 selModeIdx = i;
1915 break;
1916 }
1917 }
1918 }
1919
1920 const char* resLabel = ( fullscreenChoice && fullscreenDesktop ) ? "Window Resolution (ignored for Fullscreen Desktop Mode!)###resMode" : "Resolution###resMode";
1921

Callers 1

Calls 15

AddTooltipFunction · 0.85
AddDescrTooltipFunction · 0.85
R_GetModeInfoFunction · 0.85
MinFunction · 0.85
AddCVarOptionTooltipsFunction · 0.85
VideoHasApplyableChangesFunction · 0.85
ApplyVideoSettingsFunction · 0.85
VideoResetChangesFunction · 0.85
DrawOptionsFunction · 0.85
SetIntegerMethod · 0.80
GetIntegerMethod · 0.80

Tested by

no test coverage detected