#include "ui_extensions.lua" Options = { Width = 1184, Height = 1020, Tabs = { Width = 148, Padding = 20, gpHintIndent = 20, gpHintSize = 50, Radius = 6, Names = { { name = "gfx", locKey = "loc@UI_BUTTON_GRAPHICS" }, { name = "audio", locKey = "loc@UI_BUTTON_AUDIO" }, { name = "game", locKey = "loc@UI_BUTTON_GAME" }, { name = "input", locKey = "loc@UI_BUTTON_INPUT" }, }, AllTabsWidth = function(self) local count = #self.Names if LastInputDevice() ~= UI_DEVICE_GAMEPAD then return count * self.Width + (count - 1) * self.Padding else return count * self.Width + (count - 1) * self.Padding + self.gpHintIndent * 2 + self.gpHintSize * 2 end end, StartPosition = function(self) return (UiWidth() - self:AllTabsWidth()) / 2 end, IndexOf = function(self, name) for i=1,#self.Names do if name == self.Names[i].name then return i end end return 0 end, Init = function(self) if (IsRunningOnPC() and not IsRunningOnSteamDeck()) or IsRunningOnMac() then table.insert(self.Names, 1, { name = "display", locKey = "loc@UI_BUTTON_DISPLAY" }) end if GetBool("options.debug.mods") then table.insert(self.Names, { name = "pros", locKey = "PROS" }) end end, }, selectedTab = "", Init = function(self) self.Tabs:Init() self.selectedTab = self.Tabs.Names[1].name end, Reset = function(self) self.selectedTab = self.Tabs.Names[1].name end, DrawTabs = function(self) UiPush() UiAlign("middle left") UiTranslate(0, 22) if LastInputDevice() == UI_DEVICE_GAMEPAD then UiTextWithFont("[[menu:menu_prev]]", "regular.ttf", self.Tabs.gpHintSize) UiTranslate(self.Tabs.gpHintSize + self.Tabs.gpHintIndent, 0) end for i=1,#self.Tabs.Names do UiPush() if self.selectedTab == self.Tabs.Names[i].name then UiButtonHoverColor(1,1,1,1) UiColor(1,1,0.7) UiButtonImageBox("common/box-outline-fill-6.png", self.Tabs.Radius, self.Tabs.Radius, 1, 1, 0.7, 0.8) else UiButtonHoverColor(0.8,0.8,0.4,1) end UiButtonTextHandling(2) if UiTextButton(self.Tabs.Names[i].locKey, self.Tabs.Width, 42) then self.selectedTab = self.Tabs.Names[i].name end UiPop() UiTranslate(self.Tabs.Width + self.Tabs.Padding, 0) end if LastInputDevice() == UI_DEVICE_GAMEPAD then UiTranslate(self.Tabs.gpHintIndent - self.Tabs.Padding + 9, 0) UiTextWithFont("[[menu:menu_next]]", "regular.ttf", self.Tabs.gpHintSize) end UiPop() end, SelectNextTab = function(self) local idx = self.Tabs:IndexOf(self.selectedTab) self.selectedTab = self.Tabs.Names[math.clamp(idx + 1, 1, #self.Tabs.Names)].name end, SelectPreviousTab = function(self) local idx = self.Tabs:IndexOf(self.selectedTab) self.selectedTab = self.Tabs.Names[math.clamp(idx - 1, 1, #self.Tabs.Names)].name end, closeRequested = false, OnClose = function(self) end } gOptionTemporaryHideScale = 1