From 00a3db31e9458f132a20dc45debbc4d9f11bb4e2 Mon Sep 17 00:00:00 2001 From: jeffi Date: Fri, 29 Mar 2024 15:02:09 -0500 Subject: [PATCH] Move frames to DUIParent for scaling unification. --- DiesalGUI-2.0/DiesalGUI-2.0.lua | 53 ++++++++++++++++- DiesalGUI-2.0/Objects/Accordian.lua | 2 +- DiesalGUI-2.0/Objects/AccordianSection.lua | 59 ++++++++----------- DiesalGUI-2.0/Objects/Bar.lua | 2 +- DiesalGUI-2.0/Objects/Branch.lua | 2 +- DiesalGUI-2.0/Objects/Button.lua | 2 +- DiesalGUI-2.0/Objects/CheckBox.lua | 2 +- DiesalGUI-2.0/Objects/ComboBox.lua | 2 +- DiesalGUI-2.0/Objects/ComboBoxItem.lua | 2 +- DiesalGUI-2.0/Objects/Container.lua | 2 +- DiesalGUI-2.0/Objects/DropDown.lua | 23 ++++---- DiesalGUI-2.0/Objects/DropDownItem.lua | 13 ++-- DiesalGUI-2.0/Objects/IconToggle.lua | 2 +- DiesalGUI-2.0/Objects/Input.lua | 2 +- DiesalGUI-2.0/Objects/ScrollFrame.lua | 2 +- DiesalGUI-2.0/Objects/ScrollingEditBox.lua | 2 +- .../Objects/ScrollingMessageFrame.lua | 2 +- DiesalGUI-2.0/Objects/Spinner.lua | 2 +- DiesalGUI-2.0/Objects/Text.lua | 2 +- DiesalGUI-2.0/Objects/Toggle.lua | 2 +- DiesalGUI-2.0/Objects/Window.lua | 42 ++++++------- DiesalMenu-2.0/DiesalMenu-2.0.lua | 2 +- DiesalMenu-2.0/Objects/Menu.lua | 2 +- DiesalMenu-2.0/Objects/MenuItem.lua | 2 +- DiesalStyle-2.0/DiesalStyle-2.0.lua | 2 +- DiesalTools-2.0/DiesalTools-2.0.lua | 4 +- 26 files changed, 131 insertions(+), 103 deletions(-) diff --git a/DiesalGUI-2.0/DiesalGUI-2.0.lua b/DiesalGUI-2.0/DiesalGUI-2.0.lua index 3ba36dc..ad75096 100644 --- a/DiesalGUI-2.0/DiesalGUI-2.0.lua +++ b/DiesalGUI-2.0/DiesalGUI-2.0.lua @@ -44,6 +44,57 @@ DiesalGUI.Debug = { WhiteFont = DiesalGUIDebugWhiteFont, } +local DUIParent = CreateFrame("Frame", "DUIParent", UIParent) +DUIParent:SetFrameLevel(UIParent:GetFrameLevel()) +DUIParent:SetSize(GetScreenWidth(), GetScreenHeight()) +DUIParent:SetPoint("BOTTOM") + +DiesalGUI.UIParent = DUIParent + +DiesalGUI.Scaling = { + physicalWidth = 0, + physicalHeight = 0, + screenWidth = 0, + screenHeight = 0, + originalHeight = DUIParent:GetHeight(), + resolution = "0x0", + perfect = 0 +} + +DiesalGUI.Scaling.physicalWidth, DiesalGUI.Scaling.physicalHeight = GetPhysicalScreenSize() +DiesalGUI.Scaling.screenWidth, DiesalGUI.Scaling.screenHeight = GetScreenWidth(), GetScreenHeight() +DiesalGUI.Scaling.resolution = format("%dx%d", DiesalGUI.Scaling.physicalWidth, DiesalGUI.Scaling.physicalHeight) +DiesalGUI.Scaling.perfect = 768 / DiesalGUI.Scaling.physicalWidth + +function DiesalGUI:UIScale() + local D = self + D.Scaling.uiscale = UIParent:GetScale() + D.Scaling.screenWidth = D.Scaling.physicalWidth + D.Scaling.screenHeight = D.Scaling.physicalHeight + + local width, height = D.Scaling.physicalWidth, D.Scaling.physicalHeight + + D.UIParent:SetSize(width, height) + D.Scaling.originalHeight = D.UIParent:GetHeight() +end + +function DiesalGUI:PixelScaleChanged(event) + if event == "UI_SCALE_CHANGED" then + local S = DiesalGUI.Scaling + S.physicalWidth, S.physicalHeight = GetPhysicalScreenSize() + S.resolution = format("%dx%d", S.physicalWidth, S.physicalHeight) + S.perfect = 768 / S.physicalHeight + end +end + +DUIParent:SetScript("OnEvent", function(self, event, ...) + if event == "UI_SCALE_CHANGED" then + DiesalGUI:PixelScaleChanged(event) + end +end) + +DUIParent:RegisterEvent("UI_SCALE_CHANGED") + local CallbackHandler = LibStub("CallbackHandler-1.0") local DiesalTools = LibStub("DiesalTools-2.0") @@ -250,7 +301,7 @@ function DiesalGUI:CreateThrottle(duration, callback) assert(duration and type(duration) == "number", "duration has to be a number ") ---@class Throttle : AnimationGroup, Object, FrameScriptObject - local throttle = CreateFrame("Frame", nil, UIParent):CreateAnimationGroup() + local throttle = CreateFrame("Frame", nil, DUIParent):CreateAnimationGroup() throttle.anim = throttle:CreateAnimation("Animation") throttle.args = {} diff --git a/DiesalGUI-2.0/Objects/Accordian.lua b/DiesalGUI-2.0/Objects/Accordian.lua index 03ac8b5..14d5d5e 100644 --- a/DiesalGUI-2.0/Objects/Accordian.lua +++ b/DiesalGUI-2.0/Objects/Accordian.lua @@ -59,7 +59,7 @@ local function Constructor() self.isContainer = true - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent) self.frame = frame self.defaults = {} diff --git a/DiesalGUI-2.0/Objects/AccordianSection.lua b/DiesalGUI-2.0/Objects/AccordianSection.lua index 7c9d5f4..95bd0ae 100644 --- a/DiesalGUI-2.0/Objects/AccordianSection.lua +++ b/DiesalGUI-2.0/Objects/AccordianSection.lua @@ -39,22 +39,6 @@ local Stylesheet = { color = "ffffff", alpha = 0.1, }, - ["button-leftExpandIcon"] = { - type = "texture", - position = { 0, nil, -1, nil }, - height = 16, - width = 16, - image = { "DiesalGUIcons", { 3, 6, 16, 256, 128 }, HSL(Colors.UI_Hue, Colors.UI_Saturation, 0.65) }, - alpha = 1, - }, - ["button-leftCollapseIcon"] = { - type = "texture", - position = { 0, nil, -1, nil }, - height = 16, - width = 16, - image = { "DiesalGUIcons", { 4, 6, 16, 256, 128 }, HSL(Colors.UI_Hue, Colors.UI_Saturation, 0.65) }, - alpha = 1, - }, ["content-background"] = { type = "texture", layer = "BACKGROUND", @@ -134,10 +118,6 @@ local methods = { if self.settings.position == 1 then self:SetPoint("TOPLEFT", subsectionXOffset, subsectionYOffset) self:SetPoint("RIGHT", -subsectionXOffset, 0) - elseif self.settings.subsection then - local anchor = self.settings.parentObject.content - self:SetPoint("TOPLEFT", anchor, "BOTTOMLEFT", subsectionXOffset, subsectionYOffset) - self:SetPoint("RIGHT", -subsectionXOffset, 0) else local anchor = self.settings.parentObject.children[self.settings.position - 1].frame self:SetPoint("TOPLEFT", anchor, "BOTTOMLEFT", subsectionXOffset, subsectionYOffset) @@ -159,12 +139,14 @@ local methods = { end self.settings.expanded = false self:FireEvent("OnStateChange", self.settings.position, "Collapse") - self.textures["button-leftCollapseIcon"]:SetAlpha(self.textures["button-leftCollapseIcon"].style.alpha[1]) - self.textures["button-leftExpandIcon"]:SetAlpha(0) + --self.icon:SetTexCoord(0, 0.4375, 0, 0.4375) + --self.icon:SetAtlas("campaign_headericon_closed", false) + --self.textures["button-leftCollapseIcon"]:SetAlpha(self.textures["button-leftCollapseIcon"].style.alpha[1]) + --self.textures["button-leftExpandIcon"]:SetAlpha(0) + self.icon:SetAtlas("uitools-icon-plus") self.content:Hide() self:UpdateHeight() - if self.settings.subsection and self.settings.parentObject then - self.settings.parentObject:ApplySettings() + if self.settings.subsection and self.settings.parentObject and self.settings.parentObject.UpdateHeight then self.settings.parentObject:UpdateHeight() end end, @@ -173,12 +155,14 @@ local methods = { Expand = function(self) self.settings.expanded = true self:FireEvent("OnStateChange", self.settings.position, "Expand") - self.textures["button-leftExpandIcon"]:SetAlpha(self.textures["button-leftExpandIcon"].style.alpha[1]) - self.textures["button-leftCollapseIcon"]:SetAlpha(0) + --self.icon:SetAtlas("campaign_headericon_open", false) + --self.icon:SetTexCoord(0.5625, 1, 0, 0.4375) + --self.textures["button-leftExpandIcon"]:SetAlpha(self.textures["button-leftExpandIcon"].style.alpha[1]) + --self.textures["button-leftCollapseIcon"]:SetAlpha(0) + self.icon:SetAtlas("uitools-icon-minus") self.content:Show() self:UpdateHeight() - if self.settings.subsection and self.settings.parentObject then - self.settings.parentObject:ApplySettings() + if self.settings.subsection and self.settings.parentObject and self.settings.parentObject.UpdateHeight then self.settings.parentObject:UpdateHeight() end end, @@ -239,7 +223,7 @@ local function Constructor() self.isContainer = true - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent) self.frame = frame self.defaults = { @@ -259,8 +243,18 @@ local function Constructor() self[self.settings.expanded and "Collapse" or "Expand"](self) end) + -- 877-222-8387 + + local buttonIcon = self:CreateRegion("Texture", "icon", button) + buttonIcon:SetVertexColor(1, 1, 0) + buttonIcon:SetAtlas("uitools-icon-plus") + --buttonIcon:SetTexture("Interface\\Buttons\\UI-PlusMinus-Buttons") + --buttonIcon:SetTexCoord(0, 0.4375, 0, 0.4375) + buttonIcon:SetPoint("TOPLEFT", 1, -3) + buttonIcon:SetSize(10,10) + local text = self:CreateRegion("FontString", "text", button) - text:SetPoint("TOPLEFT", 15, -2) + text:SetPoint("TOPLEFT", 15, -1) text:SetPoint("BOTTOMRIGHT", -15, 0) text:SetHeight(0) text:SetJustifyH("MIDDLE") @@ -271,12 +265,7 @@ local function Constructor() content:SetPoint("TOPLEFT", frame, 0, 0) content:SetPoint("TOPRIGHT", frame, 0, 0) content:SetHeight(10) - -- ~~ Methods ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ self:SetMethods(methods) - --[[ for method, func in pairs(methods) do - self[method] = func - end ]] - -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return self end DiesalGUI:RegisterObjectConstructor(Type, Constructor, Version) diff --git a/DiesalGUI-2.0/Objects/Bar.lua b/DiesalGUI-2.0/Objects/Bar.lua index b382b9c..0a94c05 100644 --- a/DiesalGUI-2.0/Objects/Bar.lua +++ b/DiesalGUI-2.0/Objects/Bar.lua @@ -176,7 +176,7 @@ local function Constructor() ---@field bar Frame ---@field settings { height: number, width: number, padding: number[], value: number, min: number, max: number, barWidth: number } local self = DiesalGUI:Create(Type, true) - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent) self.frame = frame -- ~~ Default Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ self.defaults = { diff --git a/DiesalGUI-2.0/Objects/Branch.lua b/DiesalGUI-2.0/Objects/Branch.lua index a57e8ac..61f18ac 100644 --- a/DiesalGUI-2.0/Objects/Branch.lua +++ b/DiesalGUI-2.0/Objects/Branch.lua @@ -258,7 +258,7 @@ local function Constructor() self.isContainer = true - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent) self.frame = frame -- ~~ Default Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ self.defaults = { diff --git a/DiesalGUI-2.0/Objects/Button.lua b/DiesalGUI-2.0/Objects/Button.lua index 015328c..f26eb4f 100644 --- a/DiesalGUI-2.0/Objects/Button.lua +++ b/DiesalGUI-2.0/Objects/Button.lua @@ -79,7 +79,7 @@ local function Constructor(name) ---@field text Diesal.GUI.Region.FontString ---@field settings { disabled: boolean, height: number, width: number } local self = DiesalGUI:Create(Type, true) - local frame = CreateFrame("Button", name, UIParent) + local frame = CreateFrame("Button", name, DiesalGUI.UIParent) self.frame = frame self.frame.m = self self.defaults = { diff --git a/DiesalGUI-2.0/Objects/CheckBox.lua b/DiesalGUI-2.0/Objects/CheckBox.lua index 070cd7a..4cebb3b 100644 --- a/DiesalGUI-2.0/Objects/CheckBox.lua +++ b/DiesalGUI-2.0/Objects/CheckBox.lua @@ -134,7 +134,7 @@ local function Constructor() ---@field settings Diesal.GUI.CheckBox.Settings ---@field value boolean local self = DiesalGUI:Create(Type, true) - local frame = CreateFrame("CheckButton", nil, UIParent) + local frame = CreateFrame("CheckButton", nil, DiesalGUI.UIParent) self.frame = frame -- ~~ Default Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/DiesalGUI-2.0/Objects/ComboBox.lua b/DiesalGUI-2.0/Objects/ComboBox.lua index f518512..508352e 100644 --- a/DiesalGUI-2.0/Objects/ComboBox.lua +++ b/DiesalGUI-2.0/Objects/ComboBox.lua @@ -227,7 +227,7 @@ local function Constructor() ---@field settings { width: number, height: number, buttonWidth: number, dropdownPadding: table, dropdownButtonWidth: number, list: table, selectedKey: string, selectedValue: string, oldValue: string} local self = DiesalGUI:Create(Type, true) self.isContainer = true - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent) self.frame = frame -- ~~ Default Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ self.defaults = { diff --git a/DiesalGUI-2.0/Objects/ComboBoxItem.lua b/DiesalGUI-2.0/Objects/ComboBoxItem.lua index a00655c..383412f 100644 --- a/DiesalGUI-2.0/Objects/ComboBoxItem.lua +++ b/DiesalGUI-2.0/Objects/ComboBoxItem.lua @@ -105,7 +105,7 @@ local function Constructor() ---@field settings Diesal.GUI.ComboBoxItem.Settings local self = DiesalGUI:Create(Type, true) - local frame = CreateFrame("Button", nil, UIParent) + local frame = CreateFrame("Button", nil, DiesalGUI.UIParent) self.frame = frame self.defaults = {} diff --git a/DiesalGUI-2.0/Objects/Container.lua b/DiesalGUI-2.0/Objects/Container.lua index 549314d..9580a1f 100644 --- a/DiesalGUI-2.0/Objects/Container.lua +++ b/DiesalGUI-2.0/Objects/Container.lua @@ -48,7 +48,7 @@ local function Constructor() ---@field element? Diesal.GUI.ObjectBase local self = DiesalGUI:Create(Type, true) self.isContainer = true - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent) self.frame = frame self.defaults = {} diff --git a/DiesalGUI-2.0/Objects/DropDown.lua b/DiesalGUI-2.0/Objects/DropDown.lua index 193be17..841f45e 100644 --- a/DiesalGUI-2.0/Objects/DropDown.lua +++ b/DiesalGUI-2.0/Objects/DropDown.lua @@ -41,15 +41,6 @@ local Stylesheet = { color = "ffffff", alpha = 0.05, }, - ["frame-arrow"] = { - type = "texture", - layer = "BORDER", - image = { "DiesalGUIcons", { 2, 1, 16, 256, 128 } }, - alpha = 0.5, - position = { nil, -5, -7, nil }, - height = 3, - width = 5, - }, ["text-color"] = { type = "Font", color = Colors.UI_TEXT, @@ -371,11 +362,10 @@ local methods = { ---@class DiesalDropDown : Diesal.GUI.Object.DropDown -local f = CreateFrame("Button", nil, UIParent) - -- ~~| Dropdown Constructor |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ local function Constructor() ---@class Diesal.GUI.Object.DropDown : Diesal.GUI.ObjectBase, Diesal.GUI.DropDown.Methods + ---@field arrow Texture ---@field settings Diesal.GUI.Object.DropDown.Settings ---@field children Diesal.GUI.Object.DropDown.Item[] ---@field text FontString @@ -386,7 +376,7 @@ local function Constructor() self:SetMethods(methods) self.dropdownShown = true - local frame = CreateFrame("Button", nil, UIParent) + local frame = CreateFrame("Button", nil, DiesalGUI.UIParent) frame:SetFrameStrata("TOOLTIP") frame:SetClampedToScreen(true) self.frame = frame @@ -409,9 +399,11 @@ local function Constructor() frame:SetScript("OnClick", function(this, button, down) if button == "LeftButton" then if self.dropdown:IsVisible() then + self.arrow:SetRotation(0) self.dropdown:SetParent(self.frame) self.dropdown:Hide() else + self.arrow:SetRotation(math.pi) self.dropdown:SetParent(UIParent) DiesalGUI:OnMouse(self.dropdown, button) self:FixStrata("TOOLTIP", self.dropdown, { @@ -432,6 +424,13 @@ local function Constructor() self:FireEvent("OnLeave", ...) end) + local arrow = self:CreateRegion("Texture", "arrow", frame) + arrow:SetVertexColor(1, 1, 1, 0.5) + arrow:SetDrawLayer("BORDER") + arrow:SetAtlas("uitools-icon-chevron-down") + arrow:SetPoint("TOPRIGHT", -7, -3) + arrow:SetSize(10, 10) + local text = self:CreateRegion("FontString", "text", frame) text:ClearAllPoints() text:SetPoint("TOPLEFT", 4, -1) diff --git a/DiesalGUI-2.0/Objects/DropDownItem.lua b/DiesalGUI-2.0/Objects/DropDownItem.lua index 005fd0c..15e32e2 100644 --- a/DiesalGUI-2.0/Objects/DropDownItem.lua +++ b/DiesalGUI-2.0/Objects/DropDownItem.lua @@ -149,7 +149,7 @@ local function Constructor() ---@field text FontString ---@field settings Diesal.GUI.DropDownItem.Settings local self = DiesalGUI:Create(Type, true) - local frame = CreateFrame("Button", nil, UIParent) + local frame = CreateFrame("Button", nil, DiesalGUI.UIParent) frame:SetToplevel(true) frame:SetFrameLevel(999) frame:SetFrameStrata("TOOLTIP") @@ -171,13 +171,10 @@ local function Constructor() text:SetWordWrap(false) local check = self:CreateRegion("Texture", "check", frame) - DiesalStyle:StyleTexture(check, { - type = "texture", - position = { 2, nil, 0, nil }, - height = 16, - width = 16, - image = { "DiesalGUIcons", { 10, 5, 16, 256, 128 }, "FFFF00" }, - }) + check:SetAtlas("uitools-icon-checkmark", false) + check:SetPoint("LEFT", -2, 0) + check:SetPoint("TOP", 0, -2) + check:SetSize(13,13) check:Hide() local icon2 = self:CreateRegion("Texture", "icon2", frame) icon2:SetTexture(130775) diff --git a/DiesalGUI-2.0/Objects/IconToggle.lua b/DiesalGUI-2.0/Objects/IconToggle.lua index 1921433..d224b3e 100644 --- a/DiesalGUI-2.0/Objects/IconToggle.lua +++ b/DiesalGUI-2.0/Objects/IconToggle.lua @@ -168,7 +168,7 @@ local function Constructor() ---@field checkBoxStyle? Diesal.GUI.Object.IconToggle.CheckBox.Style ---@field label FontString local self = DiesalGUI:Create(Type, true) - local frame = CreateFrame("CheckButton", nil, UIParent) + local frame = CreateFrame("CheckButton", nil, DiesalGUI.UIParent) local fontString = self:CreateRegion("FontString", "label", frame) self.frame = frame diff --git a/DiesalGUI-2.0/Objects/Input.lua b/DiesalGUI-2.0/Objects/Input.lua index 0e522ae..bd09fe9 100644 --- a/DiesalGUI-2.0/Objects/Input.lua +++ b/DiesalGUI-2.0/Objects/Input.lua @@ -84,7 +84,7 @@ local function Constructor() ---@class Diesal.GUI.Object.Input : Diesal.GUI.ObjectBase, Diesal.GUI.Input.Methods ---@field editBox EditBox local self = DiesalGUI:Create(Type, true) - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent) self.frame = frame self.defaults = { height = 16, diff --git a/DiesalGUI-2.0/Objects/ScrollFrame.lua b/DiesalGUI-2.0/Objects/ScrollFrame.lua index 03c1a79..9484f78 100644 --- a/DiesalGUI-2.0/Objects/ScrollFrame.lua +++ b/DiesalGUI-2.0/Objects/ScrollFrame.lua @@ -195,7 +195,7 @@ local function Constructor() ---@field parent Diesal.GUI.Object.Window local self = DiesalGUI:Create(Type, true) self.isContainer = true - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent) self.frame = frame -- ~~ Default Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ self.defaults = { diff --git a/DiesalGUI-2.0/Objects/ScrollingEditBox.lua b/DiesalGUI-2.0/Objects/ScrollingEditBox.lua index 254b6ca..3769473 100644 --- a/DiesalGUI-2.0/Objects/ScrollingEditBox.lua +++ b/DiesalGUI-2.0/Objects/ScrollingEditBox.lua @@ -156,7 +156,7 @@ local methods = { local function Constructor() ---@class Diesal.GUI.Object.ScrollingEditBox : Diesal.GUI.ObjectBase, Diesal.GUI.ScrollingEditBox.Methods local self = DiesalGUI:Create(Type, true) - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent) self.frame = frame -- ~~ Default Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ self.defaults = { diff --git a/DiesalGUI-2.0/Objects/ScrollingMessageFrame.lua b/DiesalGUI-2.0/Objects/ScrollingMessageFrame.lua index 884b552..72c2e3e 100644 --- a/DiesalGUI-2.0/Objects/ScrollingMessageFrame.lua +++ b/DiesalGUI-2.0/Objects/ScrollingMessageFrame.lua @@ -158,7 +158,7 @@ local methods = { local function Constructor() ---@class Diesal.GUI.Object.ScrollingMessageFrame : Diesal.GUI.ObjectBase, Diesal.GUI.ScrollingMessageFrame.Methods local self = DiesalGUI:Create(Type, true) - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent) self.frame = frame -- ~~ Default Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- ~~ Default Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/DiesalGUI-2.0/Objects/Spinner.lua b/DiesalGUI-2.0/Objects/Spinner.lua index 3213b99..e16250b 100644 --- a/DiesalGUI-2.0/Objects/Spinner.lua +++ b/DiesalGUI-2.0/Objects/Spinner.lua @@ -260,7 +260,7 @@ local function Constructor() ---@field buttonDown Button ---@field editBox EditBox local self = DiesalGUI:Create(Type, true) - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent) self.frame = frame -- ~~ Default Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ self.defaults = { diff --git a/DiesalGUI-2.0/Objects/Text.lua b/DiesalGUI-2.0/Objects/Text.lua index bd8b9a5..147bdb3 100644 --- a/DiesalGUI-2.0/Objects/Text.lua +++ b/DiesalGUI-2.0/Objects/Text.lua @@ -27,7 +27,7 @@ local function Constructor() ---@field fontString FontString local self = DiesalGUI:Create(Type, true) self.defaults = {} - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent) self.frame = frame self:CreateRegion("FontString", "fontString", frame) --local fontString = frame:CreateFontString(nil, "OVERLAY", "DiesalFontNormal") diff --git a/DiesalGUI-2.0/Objects/Toggle.lua b/DiesalGUI-2.0/Objects/Toggle.lua index 9582a7f..88d87c9 100644 --- a/DiesalGUI-2.0/Objects/Toggle.lua +++ b/DiesalGUI-2.0/Objects/Toggle.lua @@ -158,7 +158,7 @@ local function Constructor() ---@field checkBoxStyle? Diesal.Style.CheckBox.Style ---@field label FontString local self = DiesalGUI:Create(Type, true) - local frame = CreateFrame("CheckButton", nil, UIParent) + local frame = CreateFrame("CheckButton", nil, DiesalGUI.UIParent) local fontString = self:CreateRegion("FontString", "label", frame) self.frame = frame diff --git a/DiesalGUI-2.0/Objects/Window.lua b/DiesalGUI-2.0/Objects/Window.lua index 2c6bc47..c696b25 100644 --- a/DiesalGUI-2.0/Objects/Window.lua +++ b/DiesalGUI-2.0/Objects/Window.lua @@ -33,24 +33,6 @@ local Stylesheet = { type = "font", color = "d8d8d8", }, - ["closeButton-icon"] = { - type = "texture", - layer = "ARTWORK", - image = { "DiesalGUIcons", { 9, 5, 16, 256, 128 } }, - alpha = 0.3, - position = { -2, nil, -1, nil }, - width = 16, - height = 16, - }, - ["closeButton-iconHover"] = { - type = "texture", - layer = "HIGHLIGHT", - image = { "DiesalGUIcons", { 9, 5, 16, 256, 128 }, "b30000" }, - alpha = 1, - position = { -2, nil, -1, nil }, - width = 16, - height = 16, - }, ["header-background"] = { type = "texture", layer = "BACKGROUND", @@ -206,8 +188,8 @@ local methods = { self:UpdateSizers() titleBar:SetHeight(settings.titleBarHeight) - closeButton:SetHeight(settings.titleBarHeight) - closeButton:SetWidth(settings.titleBarHeight) + closeButton:SetHeight(settings.titleBarHeight - 6) + closeButton:SetWidth(settings.titleBarHeight - 6) content:SetPoint("TOPLEFT", settings.padding[1], -(settings.titleBarHeight + headerHeight + settings.padding[3])) content:SetPoint("BOTTOMRIGHT", -settings.padding[2], footerHeight + settings.padding[4]) @@ -317,7 +299,7 @@ local function Constructor() self.isContainer = true ---@type Diesal.GUI.Window.Frame - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent) self.frame = frame @@ -397,7 +379,18 @@ local function Constructor() end) local closeButton = self:CreateRegion("Button", "closeButton", titleBar) - closeButton:SetPoint("TOPRIGHT", -1, 1) + closeButton:SetNormalAtlas("uitools-icon-close") + closeButton:SetHighlightAtlas("uitools-icon-close") + closeButton:GetHighlightTexture():SetVertexColor(1, 0, 0, 1) + --closeButton:SetPushedAtlas("simplecheckout-close-pressed-1x") + --closeButton:GetHighlightTexture():SetVertexColor(1, 0, 0, 1) + closeButton:SetScript("OnEnter",function() + closeButton:GetNormalTexture():Hide() + end) + closeButton:SetScript("OnLeave", function() + closeButton:GetNormalTexture():Show() + end) + closeButton:SetPoint("RIGHT", -5, -0) closeButton:SetScript("OnClick", function(this, button) DiesalGUI:OnMouse(this, button) PlaySound(799) @@ -407,9 +400,8 @@ local function Constructor() local titletext = self:CreateRegion("FontString", "titletext", titleBar) titletext:SetWordWrap(false) - titletext:SetPoint("TOPLEFT", 4, -5) - titletext:SetPoint("TOPRIGHT", -20, -5) - titletext:SetJustifyH("TOP") + titletext:SetPoint("LEFT", 4, 0) + titletext:SetPoint("RIGHT", -20, 0) titletext:SetJustifyH("LEFT") self:CreateRegion("Frame", "header", frame) diff --git a/DiesalMenu-2.0/DiesalMenu-2.0.lua b/DiesalMenu-2.0/DiesalMenu-2.0.lua index d5cc8c8..39f35b6 100644 --- a/DiesalMenu-2.0/DiesalMenu-2.0.lua +++ b/DiesalMenu-2.0/DiesalMenu-2.0.lua @@ -30,7 +30,7 @@ local CLOSEDELAY = 2 ---@class Diesal.Menu.CloseTimer : Frame ---@field closeDelay number -local closeTimer = CreateFrame("Frame") +local closeTimer = CreateFrame("Frame", nil, DiesalGUI.UIParent) closeTimer:Hide() ---@param this Diesal.Menu.CloseTimer diff --git a/DiesalMenu-2.0/Objects/Menu.lua b/DiesalMenu-2.0/Objects/Menu.lua index 508160e..f05355a 100644 --- a/DiesalMenu-2.0/Objects/Menu.lua +++ b/DiesalMenu-2.0/Objects/Menu.lua @@ -125,7 +125,7 @@ local methods = { local function Constructor() ---@class Diesal.Menu.Menu : Diesal.GUI.ObjectBase, Diesal.Menu.Menu.Methods local self = DiesalGUI:Create(Type, true) - local frame = CreateFrame("Frame", nil, UIParent) + local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent) self.frame = frame self.defaults = { itemWidth = 0, diff --git a/DiesalMenu-2.0/Objects/MenuItem.lua b/DiesalMenu-2.0/Objects/MenuItem.lua index 1c8ee7b..a32b39c 100644 --- a/DiesalMenu-2.0/Objects/MenuItem.lua +++ b/DiesalMenu-2.0/Objects/MenuItem.lua @@ -128,7 +128,7 @@ local function Constructor() ---@field check Texture ---@field arrow Texture local self = DiesalGUI:Create(Type, true) - local frame = CreateFrame("Button", nil, UIParent) + local frame = CreateFrame("Button", nil, DiesalGUI.UIParent) self.frame = frame -- ~~ Default Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ self.defaults = { diff --git a/DiesalStyle-2.0/DiesalStyle-2.0.lua b/DiesalStyle-2.0/DiesalStyle-2.0.lua index 8d4a524..ec9e8e6 100644 --- a/DiesalStyle-2.0/DiesalStyle-2.0.lua +++ b/DiesalStyle-2.0/DiesalStyle-2.0.lua @@ -594,7 +594,7 @@ do -- | Set Fonts |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ local font = getMedia("font", "calibrib") if font then DiesalFontNormal = CreateFont("DiesalFontNormal") - DiesalFontNormal:SetFont(font, 11, "") + DiesalFontNormal:SetFont("Fonts\\SourceCodePro-Regular.ttf", 11, "") end local font = getMedia("font", "calibrib") diff --git a/DiesalTools-2.0/DiesalTools-2.0.lua b/DiesalTools-2.0/DiesalTools-2.0.lua index e162db7..4742181 100644 --- a/DiesalTools-2.0/DiesalTools-2.0.lua +++ b/DiesalTools-2.0/DiesalTools-2.0.lua @@ -618,11 +618,11 @@ end ---@param xOffset? number ---@param yOffset? number ---@return number, number, number, number, number, number, number, number -function DiesalTools.GetTexCoord(zoomPercent, width, height, xOffset, yOffset) +function DiesalTools.GetTexCoords(zoomPercent, width, height, xOffset, yOffset) xOffset = xOffset or 0 yOffset = yOffset or 0 local textureWidth = 1 - 0.5 * zoomPercent - local aspectRatio = width == 0 or height == 0 and 1 or width / height + local aspectRatio = (width == 0 or height == 0) and 1 or width / height ---@type table local currentCoord = {} currentCoord[1], currentCoord[2], currentCoord[3], currentCoord[4], currentCoord[5], currentCoord[6], currentCoord[7], currentCoord[8] = 0, 0, 0, 1, 1, 0, 1, 1