Skip to content

Commit

Permalink
Several tooltips now has thicker lines, bigger icons and smooth round…
Browse files Browse the repository at this point in the history
…ed corners
  • Loading branch information
Tercioo committed Mar 8, 2024
1 parent c4ee7e8 commit c1e1191
Show file tree
Hide file tree
Showing 9 changed files with 191 additions and 138 deletions.
4 changes: 4 additions & 0 deletions Definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@
---@field TextureAtlas table<atlasname, df_atlasinfo>
---@field playername string
---@field breakdown_general profile_breakdown_settings
---@field DefaultTooltipIconSize number default size of the icons in the tooltip, this also dictates the size of each line in the tooltip
---@field
---@field
---@field
---@field GetDisplayClassByDisplayId fun(self: details, displayId: number) : table -return the class object for the given displayId (attributeId)
---@field GetTextureAtlas fun(self: details, atlasName: atlasname) : df_atlasinfo return the texture atlas data
Expand Down Expand Up @@ -389,6 +392,7 @@
---@field serial string
---@field spec number
---@field grupo boolean
---@field classe string
---@field fight_component boolean
---@field boss_fight_component boolean
---@field pvp_component boolean
Expand Down
50 changes: 40 additions & 10 deletions Libs/DF/cooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ local max = math.max

--api locals
local PixelUtil = PixelUtil or DFPixelUtil
local version = 22
local version = 23

local CONST_MENU_TYPE_MAINMENU = "main"
local CONST_MENU_TYPE_SUBMENU = "sub"
Expand Down Expand Up @@ -106,7 +106,7 @@ function DF:CreateCoolTip()

--options table
gameCooltip.OptionsList = {
["RightTextMargin"] = true,
["RightTextMargin"] = true, --offset between the right text to the right icon, default: -3
["IconSize"] = true,
["HeightAnchorMod"] = true,
["WidthAnchorMod"] = true,
Expand All @@ -122,10 +122,10 @@ function DF:CreateCoolTip()
["TextHeightMod"] = true,
["ButtonHeightMod"] = true,
["ButtonHeightModSub"] = true,
["YSpacingMod"] = true,
["YSpacingMod"] = true, --space between each line, does not work with 'IgnoreButtonAutoHeight' and 'AlignAsBlizzTooltip'
["YSpacingModSub"] = true,
["ButtonsYMod"] = true,
["ButtonsYModSub"] = true,
["ButtonsYMod"] = true, --amount of space to leave between the top border and the first line of the tooltip, default: 0
["ButtonsYModSub"] = true, --amount of space to leave between the top border and the first line of the tooltip, default: 0
["IconHeightMod"] = true,
["StatusBarHeightMod"] = true,
["StatusBarTexture"] = true,
Expand All @@ -144,8 +144,8 @@ function DF:CreateCoolTip()
["RelativeAnchor"] = true,
["NoLastSelectedBar"] = true,
["SubMenuIsTooltip"] = true,
["LeftBorderSize"] = true,
["RightBorderSize"] = true,
["LeftBorderSize"] = true, --offset between the left border and the left icon, default: 10 + offset
["RightBorderSize"] = true, --offset between the right border and the right icon, default: -10 + offset
["HeighMod"] = true,
["HeighModSub"] = true,
["IconBlendMode"] = true,
Expand Down Expand Up @@ -192,7 +192,7 @@ function DF:CreateCoolTip()

--move each line in the Y axis (vertical offsett)
["LineYOffset"] = "ButtonsYMod",
["VerticalOffset"] = "ButtonsYMod",
["VerticalOffset"] = "ButtonsYMod", --amount of space to leave between the top border and the first line of the tooltip, default: 0
["LineYOffsetSub"] = "ButtonsYModSub",
["VerticalOffsetSub"] = "ButtonsYModSub",
}
Expand Down Expand Up @@ -232,7 +232,7 @@ function DF:CreateCoolTip()

gameCooltip.RoundedFramePreset = {
color = {.075, .075, .075, 1},
border_color = {.2, .2, .2, 1},
border_color = {.3, .3, .3, 1},
roundness = 8,
}

Expand Down Expand Up @@ -378,6 +378,9 @@ function DF:CreateCoolTip()

frame1.frameBackgroundTexture:Hide()
frame2.frameBackgroundTexture:Hide()

frame1.gradientTexture:Hide()
frame2.gradientTexture:Hide()
end

function GameCooltip:HideRoundedCorner()
Expand All @@ -390,6 +393,9 @@ function DF:CreateCoolTip()

frame1.frameBackgroundTexture:Show()
frame2.frameBackgroundTexture:Show()

frame1.gradientTexture:Show()
frame2.gradientTexture:Show()
end

gameCooltip.frame1 = frame1
Expand Down Expand Up @@ -613,10 +619,18 @@ function DF:CreateCoolTip()
statusbar.leftIcon:SetSize(16, 16)
statusbar.leftIcon:SetPoint("LEFT", statusbar, "LEFT", 0, 0)

statusbar.leftIconMask = statusbar:CreateMaskTexture("$parent_LeftIconMask", "artwork")
statusbar.leftIconMask:SetAllPoints(statusbar.leftIcon)
statusbar.leftIcon:AddMaskTexture(statusbar.leftIconMask)

statusbar.rightIcon = statusbar:CreateTexture("$parent_RightIcon", "OVERLAY")
statusbar.rightIcon:SetSize(16, 16)
statusbar.rightIcon:SetPoint("RIGHT", statusbar, "RIGHT", 0, 0)

statusbar.rightIconMask = statusbar:CreateMaskTexture("$parent_RightIconMask", "artwork")
statusbar.rightIconMask:SetAllPoints(statusbar.rightIcon)
statusbar.rightIcon:AddMaskTexture(statusbar.rightIconMask)

statusbar.spark2 = statusbar:CreateTexture("$parent_Spark2", "OVERLAY")
statusbar.spark2:SetSize(32, 32)
statusbar.spark2:SetPoint("LEFT", statusbar, "RIGHT", -17, -1)
Expand Down Expand Up @@ -659,6 +673,8 @@ function DF:CreateCoolTip()
self:RegisterForClicks("LeftButtonDown")
self.leftIcon = self.statusbar.leftIcon
self.rightIcon = self.statusbar.rightIcon
self.leftIconMask = self.statusbar.leftIconMask
self.rightIconMask = self.statusbar.rightIconMask
self.texture = self.statusbar.texture
self.spark = self.statusbar.spark
self.spark2 = self.statusbar.spark2
Expand Down Expand Up @@ -1183,6 +1199,12 @@ function DF:CreateCoolTip()
textureObject:SetHeight(leftIconSettings[3])
textureObject:SetTexCoord(leftIconSettings[4], leftIconSettings[5], leftIconSettings[6], leftIconSettings[7])

if (leftIconSettings[10]) then
menuButton.leftIconMask:SetTexture(leftIconSettings[10])
else
menuButton.leftIconMask:SetTexture([[Interface\COMMON\common-iconmask]])
end

local colorRed, colorGreen, colorBlue, colorAlpha = DF:ParseColors(leftIconSettings[8])
textureObject:SetVertexColor(colorRed, colorGreen, colorBlue, colorAlpha)

Expand Down Expand Up @@ -1240,6 +1262,12 @@ function DF:CreateCoolTip()
menuButton.rightIcon:SetHeight(rightIconSettings[3])
menuButton.rightIcon:SetTexCoord(rightIconSettings[4], rightIconSettings[5], rightIconSettings[6], rightIconSettings[7])

if (rightIconSettings[10]) then
menuButton.rightIconMask:SetTexture(rightIconSettings[10])
else
menuButton.rightIconMask:SetTexture([[Interface\COMMON\common-iconmask]])
end

local colorRed, colorGreen, colorBlue, colorAlpha = DF:ParseColors(rightIconSettings[8])
menuButton.rightIcon:SetVertexColor(colorRed, colorGreen, colorBlue, colorAlpha)

Expand Down Expand Up @@ -3186,7 +3214,7 @@ function DF:CreateCoolTip()
return gameCooltip:AddIcon(iconTexture, menuType, side, iconWidth, iconHeight, leftCoord, rightCoord, topCoord, bottomCoord, overlayColor, point, desaturated)
end

function gameCooltip:AddIcon(iconTexture, menuType, side, iconWidth, iconHeight, leftCoord, rightCoord, topCoord, bottomCoord, overlayColor, point, desaturated)
function gameCooltip:AddIcon(iconTexture, menuType, side, iconWidth, iconHeight, leftCoord, rightCoord, topCoord, bottomCoord, overlayColor, point, desaturated, mask)
--need a previous line
if (gameCooltip.Indexes == 0) then
return gameCooltip:PrintDebug("AddIcon() requires an already added line (Cooltip:AddLine()).")
Expand Down Expand Up @@ -3248,6 +3276,7 @@ function DF:CreateCoolTip()
gameCooltip.TopIconTableSub[gameCooltip.Indexes][7] = bottomCoord or 1
gameCooltip.TopIconTableSub[gameCooltip.Indexes][8] = overlayColor or defaultWhiteColor
gameCooltip.TopIconTableSub[gameCooltip.Indexes][9] = desaturated
gameCooltip.TopIconTableSub[gameCooltip.Indexes][10] = mask
return
end

Expand Down Expand Up @@ -3280,6 +3309,7 @@ function DF:CreateCoolTip()
iconTable[7] = bottomCoord or 1 --default 1
iconTable[8] = overlayColor or defaultWhiteColor --default 1, 1, 1
iconTable[9] = desaturated
iconTable[10] = mask

return true
end
Expand Down
2 changes: 1 addition & 1 deletion Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 519
local dversion = 520
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)

Expand Down
2 changes: 2 additions & 0 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
return Details.gameVersionPrefix .. " " .. Details.build_counter .. " " .. alphaId .. " " .. Details.game_version .. ""
end

Details.DefaultTooltipIconSize = 20

--namespace for the player breakdown window
Details.PlayerBreakdown = {}
Details222.PlayerBreakdown = {
Expand Down
Loading

0 comments on commit c1e1191

Please sign in to comment.