#include "graphic_options_logic.lua" #include "ui/ui_extensions.lua" #include "common_components.lua" GraphicsSettings.listItems = {} GraphicsSettings.empty = { w = 0, h = 0, draw = function(self) end, } GraphicsSettings.item1 = { w = 1008.0, h = 50.0, draw = function(self) renderScaleTooltip.x = self.w + 100 renderScaleTooltip.y = 0 drawOptionsListItemWithStepper(renderScaleText, stepperRenderScaleParams, renderScaleTooltip) end, } if IsRunningOnPC() or IsRunningOnApple() then table.insert(GraphicsSettings.listItems, GraphicsSettings.item1) end GraphicsSettings.item2 = { w = 1008.0, h = 50.0, draw = function(self) renderQuallityTooltip.x = self.w + 100 renderQuallityTooltip.y = 0 drawOptionsListItemWithStepper(renderQuallityText, stepperRenderQuallityParams, renderQuallityTooltip) end, } if IsRunningOnPC() or IsRunningOnApple() then table.insert(GraphicsSettings.listItems, GraphicsSettings.item2) end GraphicsSettings.item3 = { w = 1008.0, h = 50.0, draw = function() drawOptionsListItemWithStepper(particlesText, sliderParticleParams) end, } if IsRunningOnPC() or IsRunningOnApple() then table.insert(GraphicsSettings.listItems, GraphicsSettings.item3) end GraphicsSettings.item4 = { w = 1008.0, h = 50.0, draw = function() drawOptionsListItemWithSlider(gammaText, sliderGammaParams) end, } table.insert(GraphicsSettings.listItems, GraphicsSettings.item4) GraphicsSettings.item5 = { w = 1008.0, h = 50.0, draw = function() drawOptionsListItemWithSlider(foVText, sliderFoVParams) end, } table.insert(GraphicsSettings.listItems, GraphicsSettings.item5) GraphicsSettings.item6 = { w = 1008.0, h = 50.0, draw = function() drawOptionsListItemWithStepper(doFText, stepperDoFParams) end, } table.insert(GraphicsSettings.listItems, GraphicsSettings.item6) GraphicsSettings.item7 = { w = 1008.0, h = 50.0, draw = function() drawOptionsListItemWithStepper(barrelDistortText, stepperBarrelDistortParams) end, } table.insert(GraphicsSettings.listItems, GraphicsSettings.item7) GraphicsSettings.item8 = { w = 1008.0, h = 50.0, draw = function() drawOptionsListItemWithStepper(motionBlurText, stepperMotionBlurParams) end, } table.insert(GraphicsSettings.listItems, GraphicsSettings.item8) GraphicsSettings.item9 = { w = 1008.0, h = 50.0, draw = function(self) VSyncTooltip.x = self.w + 100 VSyncTooltip.y = 0 if stepperVSyncParams.fetchAvailableValues ~= nil then stepperVSyncParams:fetchAvailableValues() end drawOptionsListItemWithStepper(vSyncText, stepperVSyncParams) end, } if IsRunningOnPC() or IsRunningOnMac() then table.insert(GraphicsSettings.listItems, GraphicsSettings.item9) end GraphicsSettings.item10 = { w = 1008.0, h = 50.0, draw = function(self) drawOptionsListItemWithStepper(gfxModeTex, stepperGfxModeParams) end, } if IsRunningOnXboxX() or IsRunningOnPlaystation5() then table.insert(GraphicsSettings.listItems, GraphicsSettings.item10) end GraphicsSettings.item11 = { w = 1008.0, h = 50.0, draw = function(self) drawOptionsListItemWithStepper(displayMode120HzText, stepperDisplayMode120HzParams) end, } if IsRunningOnXboxX() or IsRunningOnPlaystation5() then if GetInt("options.gfx.mode") == 0 then table.insert(GraphicsSettings.listItems, GraphicsSettings.item11) else table.insert(GraphicsSettings.listItems, GraphicsSettings.empty) end end GraphicsSettings.item12 = { w = 1008.0, h = 50.0, draw = function(self) if (GetInt("options.gfx.d3d12support") == 1) or (not stepperGraphicsApiParams.canChange) then graphicsApiTooltip.x = self.w + 100 graphicsApiTooltip.y = 0 drawOptionsListItemWithStepper(graphicsApiText, stepperGraphicsApiParams, graphicsApiTooltip) else drawOptionsListItemWithStepper(graphicsApiText, stepperGraphicsApiParams) end end, } if IsRunningOnPC() and GetInt("options.gfx.d3d12support") ~= 2 then table.insert(GraphicsSettings.listItems, GraphicsSettings.item12) end GraphicsSettings.backGround = { w = 12.0, h = 232.0, draw = function() UiPush() UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#525252_o1.00_cr4.png", 12.0, 232.0, 4, 4) UiPop() end, } GraphicsSettings.thumb = { w = 8.0, h = 127.0, draw = function() UiPush() UiTranslate(2.0, 1.9999999999999982) UiColor(1, 1, 1, 1) UiImageBox("common/rect_c#ffffff_o1.00_cr3.png", 8.0, 127.0, 3, 3) UiPop() end, } GraphicsSettings.scrollBar = UiCreateScrollBar(GraphicsSettings.thumb, GraphicsSettings.backGround) function drawGraphicsApplyButton() if LastInputDevice() == UI_DEVICE_GAMEPAD then UiPush() UiDrawHintsCentered({{ ico="[[menu:menu_accept;iconsize=42,42]]", txt="loc@UI_BUTTON_APPLY" }}) if InputPressed("menu_accept") then stepperGraphicsApiParams:applyChanges() Command("game.restart") end UiPop() else UiPush() UiAlign("middle center") UiColor(0.8, 0.8, 0.8, 1) UiButtonHoverColor(1.25, 1.25, 0.625, 1) UiButtonImageBox("common/rect_c#000000_o0.00_sw1.50_sc#ffffff_so0.30_cr4.png", 6, 6, 1, 1, 1) UiFont("regular.ttf", 25) if UiTextButton("loc@UI_BUTTON_APPLY", 271.5, 39.5) then stepperGraphicsApiParams:applyChanges() Command("game.restart") end UiPop() end end function drawGraphicsOptions() -- draw frame F160_114_GraphicsTab UiPush() UiAlign("top left") UiTranslate(-495, -50) UiColorFilter(1.0, 1.0, 1.0, 1) UiPush() UiTranslate(12.0, 0.0) UiList(1008.0, 500.0, GraphicsSettings.listItems, GraphicsSettings.scrollBar) UiPop() UiPop() UiPush() UiTranslateToScreenCenter(0, 790) if stepperGraphicsApiParams:hasChanges() then drawGraphicsApplyButton() else drawGenericOptionHint(GraphicsSettings.onResetRequested) end UiPop() end