pixel perfect option added
This commit is contained in:
parent
069ca47210
commit
1010d59bd3
@ -190,6 +190,7 @@ function Gladdy:UpdateFrame()
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.frame:SetScale(self.db.frameScale)
|
self.frame:SetScale(self.db.frameScale)
|
||||||
|
self:PixelPerfectScale(false)
|
||||||
self.frame:SetWidth(width)
|
self.frame:SetWidth(width)
|
||||||
self.frame:SetHeight(height)
|
self.frame:SetHeight(height)
|
||||||
self.frame:ClearAllPoints()
|
self.frame:ClearAllPoints()
|
||||||
|
26
Gladdy.lua
26
Gladdy.lua
@ -5,6 +5,7 @@ local select = select
|
|||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local tinsert = table.insert
|
local tinsert = table.insert
|
||||||
local tsort = table.sort
|
local tsort = table.sort
|
||||||
|
local str_lower = string.lower
|
||||||
local GetTime = GetTime
|
local GetTime = GetTime
|
||||||
local CreateFrame = CreateFrame
|
local CreateFrame = CreateFrame
|
||||||
local DEFAULT_CHAT_FRAME = DEFAULT_CHAT_FRAME
|
local DEFAULT_CHAT_FRAME = DEFAULT_CHAT_FRAME
|
||||||
@ -66,10 +67,20 @@ end
|
|||||||
Gladdy.events = CreateFrame("Frame")
|
Gladdy.events = CreateFrame("Frame")
|
||||||
Gladdy.events.registered = {}
|
Gladdy.events.registered = {}
|
||||||
Gladdy.events:RegisterEvent("PLAYER_LOGIN")
|
Gladdy.events:RegisterEvent("PLAYER_LOGIN")
|
||||||
|
Gladdy.events:RegisterEvent("CVAR_UPDATE")
|
||||||
|
hooksecurefunc("VideoOptionsFrameOkay_OnClick", function(self, button, down, apply)
|
||||||
|
if (self:GetName() == "VideoOptionsFrameApply") then
|
||||||
|
Gladdy:PixelPerfectScale(true)
|
||||||
|
end
|
||||||
|
end)
|
||||||
Gladdy.events:SetScript("OnEvent", function(self, event, ...)
|
Gladdy.events:SetScript("OnEvent", function(self, event, ...)
|
||||||
if (event == "PLAYER_LOGIN") then
|
if (event == "PLAYER_LOGIN") then
|
||||||
Gladdy:OnInitialize()
|
Gladdy:OnInitialize()
|
||||||
Gladdy:OnEnable()
|
Gladdy:OnEnable()
|
||||||
|
elseif (event == "CVAR_UPDATE") then
|
||||||
|
if (str_lower(select(1, ...)) == "uiscale") then
|
||||||
|
Gladdy:PixelPerfectScale(true)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
local func = self.registered[event]
|
local func = self.registered[event]
|
||||||
|
|
||||||
@ -186,6 +197,21 @@ function Gladdy:DeleteUnknownOptions(tbl, refTbl, str)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Gladdy:PixelPerfectScale(update)
|
||||||
|
local physicalWidth, physicalHeight = GetPhysicalScreenSize()
|
||||||
|
local perfectUIScale = 768/physicalHeight--768/select(2, strsplit("x",({ GetScreenResolutions()})[GetCurrentResolution()]))
|
||||||
|
if self.db and self.db.pixelPerfect and self.frame then
|
||||||
|
self.frame:SetIgnoreParentScale(true)
|
||||||
|
self.frame:SetScale(perfectUIScale)
|
||||||
|
--self.db.frameScale = perfectUIScale --(GetCVar("useUiScale") == "1" and 1 + perfectUIScale - GetCVar("UIScale") or perfectUIScale)
|
||||||
|
if update then
|
||||||
|
self:UpdateFrame()
|
||||||
|
end
|
||||||
|
elseif self.frame then
|
||||||
|
self.frame:SetIgnoreParentScale(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function Gladdy:OnInitialize()
|
function Gladdy:OnInitialize()
|
||||||
self.dbi = LibStub("AceDB-3.0"):New("GladdyXZ", self.defaults)
|
self.dbi = LibStub("AceDB-3.0"):New("GladdyXZ", self.defaults)
|
||||||
self.dbi.RegisterCallback(self, "OnProfileChanged", "OnProfileChanged")
|
self.dbi.RegisterCallback(self, "OnProfileChanged", "OnProfileChanged")
|
||||||
|
18
Options.lua
18
Options.lua
@ -50,6 +50,7 @@ Gladdy.defaults = {
|
|||||||
growUp = false,
|
growUp = false,
|
||||||
growDirection = "BOTTOM",
|
growDirection = "BOTTOM",
|
||||||
frameScale = 1,
|
frameScale = 1,
|
||||||
|
pixelPerfect = false,
|
||||||
padding = 1,
|
padding = 1,
|
||||||
barWidth = 180,
|
barWidth = 180,
|
||||||
bottomMargin = 2,
|
bottomMargin = 2,
|
||||||
@ -298,11 +299,18 @@ function Gladdy:SetupOptions()
|
|||||||
name = L["Frame General"],
|
name = L["Frame General"],
|
||||||
order = 3,
|
order = 3,
|
||||||
},
|
},
|
||||||
|
pixelPerfect = {
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Pixel Perfect Scale"],
|
||||||
|
desc = L["Enables Pixel Perfect Scale - disables manual "].. L["Frame scale"],
|
||||||
|
order = 4,
|
||||||
|
},
|
||||||
frameScale = {
|
frameScale = {
|
||||||
type = "range",
|
type = "range",
|
||||||
name = L["Frame scale"],
|
name = L["Frame scale"],
|
||||||
desc = L["Scale of the frame"],
|
desc = L["Scale of the frame"],
|
||||||
order = 4,
|
disabled = function() return Gladdy.db.pixelPerfect end,
|
||||||
|
order = 5,
|
||||||
min = .1,
|
min = .1,
|
||||||
max = 2,
|
max = 2,
|
||||||
step = .01,
|
step = .01,
|
||||||
@ -311,7 +319,7 @@ function Gladdy:SetupOptions()
|
|||||||
type = "range",
|
type = "range",
|
||||||
name = L["Frame padding"],
|
name = L["Frame padding"],
|
||||||
desc = L["Padding of the frame"],
|
desc = L["Padding of the frame"],
|
||||||
order = 5,
|
order = 6,
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 20,
|
max = 20,
|
||||||
step = 1,
|
step = 1,
|
||||||
@ -320,7 +328,7 @@ function Gladdy:SetupOptions()
|
|||||||
type = "range",
|
type = "range",
|
||||||
name = L["Frame width"],
|
name = L["Frame width"],
|
||||||
desc = L["Width of the bars"],
|
desc = L["Width of the bars"],
|
||||||
order = 6,
|
order = 7,
|
||||||
min = 10,
|
min = 10,
|
||||||
max = 500,
|
max = 500,
|
||||||
step = 5,
|
step = 5,
|
||||||
@ -329,7 +337,7 @@ function Gladdy:SetupOptions()
|
|||||||
type = "range",
|
type = "range",
|
||||||
name = L["Margin"],
|
name = L["Margin"],
|
||||||
desc = L["Margin between each button"],
|
desc = L["Margin between each button"],
|
||||||
order = 7,
|
order = 8,
|
||||||
min = -200,
|
min = -200,
|
||||||
max = 200,
|
max = 200,
|
||||||
step = 1,
|
step = 1,
|
||||||
@ -338,7 +346,7 @@ function Gladdy:SetupOptions()
|
|||||||
type = "color",
|
type = "color",
|
||||||
name = L["Background color"],
|
name = L["Background color"],
|
||||||
desc = L["Background Color of the frame"],
|
desc = L["Background Color of the frame"],
|
||||||
order = 8,
|
order = 9,
|
||||||
hasAlpha = true,
|
hasAlpha = true,
|
||||||
get = getColorOpt,
|
get = getColorOpt,
|
||||||
set = setColorOpt,
|
set = setColorOpt,
|
||||||
|
Loading…
Reference in New Issue
Block a user