mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-04 12:40:02 +00:00
pixelperfect: enable native scaling (disabled)
This commit is contained in:
@@ -3,6 +3,7 @@ pfUI_config = {}
|
||||
|
||||
function pfUI:LoadConfig()
|
||||
-- MODULE SUBGROUP ENTRY VALUE
|
||||
pfUI:UpdateConfig("global", nil, "pixelperfect", "0")
|
||||
pfUI:UpdateConfig("global", nil, "font_size", "12")
|
||||
pfUI:UpdateConfig("global", nil, "font_default", "arial")
|
||||
pfUI:UpdateConfig("global", nil, "font_square", "homespun")
|
||||
|
||||
@@ -602,6 +602,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
-- global
|
||||
pfUI.gui.global = pfUI.gui:CreateConfigTab("Global Settings")
|
||||
local values = { "arial", "homespun", "diediedie" }
|
||||
pfUI.gui:CreateConfig(pfUI.gui.global, "Use Pixelperfect (native resolution) scaling", pfUI_config.global, "pixelperfect", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.global, "Fontsize", pfUI_config.global, "font_size")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.global, "Default Font", pfUI_config.global, "font_default", "dropdown", values)
|
||||
pfUI.gui:CreateConfig(pfUI.gui.global, "Square Font", pfUI_config.global, "font_square", "dropdown", values)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
pfUI:RegisterModule("pixelperfect", function ()
|
||||
if pfUI_config.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)
|
||||
Reference in New Issue
Block a user