diff --git a/api/config.lua b/api/config.lua index ac6e0562..b99a5bf8 100644 --- a/api/config.lua +++ b/api/config.lua @@ -25,6 +25,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("global", nil, "language", GetLocale()) pfUI:UpdateConfig("global", nil, "profile", "default") pfUI:UpdateConfig("global", nil, "pixelperfect", "0") + pfUI:UpdateConfig("global", nil, "hdgraphic", "0") pfUI:UpdateConfig("global", nil, "offscreen", "0") pfUI:UpdateConfig("global", nil, "font_default", "Interface\\AddOns\\pfUI\\fonts\\Myriad-Pro.ttf") diff --git a/modules/gui.lua b/modules/gui.lua index 8933a80e..e52155bd 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -517,7 +517,8 @@ pfUI:RegisterModule("gui", function () CreateConfig(this, T["Unit Frame Text Font"], C.global, "font_unit", "dropdown", pfUI.gui.dropdowns.fonts) CreateConfig(this, T["Unit Frame Text Size"], C.global, "font_unit_size") CreateConfig(this, T["Scrolling Combat Text Font"], C.global, "font_combat", "dropdown", pfUI.gui.dropdowns.fonts) - CreateConfig(this, T["Enable Pixel Perfect (Native Resolution)"], C.global, "pixelperfect", "checkbox") + CreateConfig(this, T["Enable Native UI-Scale"], C.global, "pixelperfect", "checkbox") + CreateConfig(this, T["Enable Maximum Graphic Details"], C.global, "hdgraphic", "checkbox") CreateConfig(this, T["Enable Offscreen Frame Positions"], C.global, "offscreen", "checkbox") CreateConfig(this, T["Enable Single Line UIErrors"], C.global, "errors_limit", "checkbox") CreateConfig(this, T["Disable All UIErrors"], C.global, "errors_hide", "checkbox") diff --git a/modules/hdgraphic.lua b/modules/hdgraphic.lua index fc0d1399..eaab47be 100644 --- a/modules/hdgraphic.lua +++ b/modules/hdgraphic.lua @@ -1,5 +1,25 @@ pfUI:RegisterModule("hdgraphic", function () - local function HDGraphicSettings() + + -- pixelperfect: native UIScale + if C.global.pixelperfect == "1" then + local f = CreateFrame("Frame") + f:RegisterEvent("PLAYER_ENTERING_WORLD") + f:SetScript("OnEvent", function() + local resolution = GetCVar("gxResolution") + + for screenwidth, screenheight in string.gfind(resolution, "(.+)x(.+)") do + local screenheight = tonumber(screenheight) < 2160 and tonumber(screenheight) or tonumber(screenheight) / 2 + local scale = 768/screenheight + UIParent:SetScale(scale) + UIParent:SetWidth(screenwidth) + UIParent:SetHeight(screenheight) + UIParent:SetPoint("CENTER",0,0) + end + end) + end + + -- hdgraphic: use maximum graphic details + if C.global.hdgraphic == "1" then ConsoleExec("anisotropic 16") ConsoleExec("detailDoodadAlpha 100") ConsoleExec("farclip 777") @@ -61,14 +81,11 @@ pfUI:RegisterModule("hdgraphic", function () ConsoleExec("M2UseShaders 1") ConsoleExec("M2BatchDoodads 1") ConsoleExec("bspcache 1") - - ConsoleExec("gxrestart") local cur, max = GetCurrentResolution(), table.getn({GetScreenResolutions()}) if cur ~= max then SetScreenResolution(max) + ConsoleExec("gxrestart") ReloadUI() end end - local txt = T["|cff33ffccBlizzard: \"Graphic Settings\"|r\n\nDo you want me to setup your game to the maximum graphic details?"] - pfUI.firstrun:AddStep("hdgraphic", HDGraphicSettings, nil, txt) end) diff --git a/modules/pixelperfect.lua b/modules/pixelperfect.lua deleted file mode 100644 index 9ff50b88..00000000 --- a/modules/pixelperfect.lua +++ /dev/null @@ -1,15 +0,0 @@ -pfUI:RegisterModule("pixelperfect", function () - if C.global.pixelperfect == "1" then - local resolution = GetCVar("gxResolution") - for screenwidth, screenheight in string.gfind(resolution, "(.+)x(.+)") do - local scale = (min(2, max(.64, 768/screenheight))) - SetCVar("UseUIScale", 1) - SetCVar("UIScale", scale) - - -- scale UIParent to native screensize - UIParent:SetWidth(screenwidth) - UIParent:SetHeight(screenheight) - UIParent:SetPoint("CENTER",0,0) - end - end -end) diff --git a/pfUI.toc b/pfUI.toc index 7daec089..bb5f91bf 100644 --- a/pfUI.toc +++ b/pfUI.toc @@ -43,7 +43,6 @@ env\fonts.lua modules\firstrun.lua modules\gui.lua modules\unlock.lua -modules\pixelperfect.lua modules\hoverbind.lua modules\actionbar.lua modules\hunterbar.lua