-
Notifications
You must be signed in to change notification settings - Fork 0
Textures
The Textures module (RGXTextures) manages statusbar texture registration, selection, and integration with LibSharedMedia.
Register a statusbar texture:
Textures:RegisterBar("MyBar", "Interface\\AddOns\\MyAddon\\Textures\\bar.tga", {
category = "MyAddon",
})Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Texture name (used as key) |
path |
string | Yes | Texture file path |
opts.category |
string | No | Grouping category (default "Custom") |
Get the texture path for a registered statusbar:
local path = Textures:GetBar("Blizzard")
-- → "Interface\\TargetingFrame\\UI-StatusBar"Array of all registered statusbar names:
local bars = Textures:ListBars()
for _, name in ipairs(bars) do
print(name, Textures:GetBar(name))
endCurrent default statusbar name. Default: "Blizzard".
Set the default statusbar. Must be a registered name:
Textures:SetDefaultBar("MyBar")Create a statusbar texture selection dropdown:
local holder = Textures:CreateBarDropdown(parent, {
title = "Select Bar Texture",
onChange = function(barName)
myStatusBar:SetStatusBarTexture(Textures:GetBar(barName))
end,
})Create a bar dropdown + reset button bound to a saved variable:
local control = Textures:CreateBarSettingControl(parent, {
label = "Bar Texture",
storage = MyAddonDB.profile,
key = "barTexture",
})Scan LibSharedMedia-3.0 (if loaded) for statusbar textures and register them. This is called automatically on the first call to GetBar(), ListBars(), or CreateBarDropdown() if LSM is present.
You can call it manually to force a re-scan:
Textures:ImportLSM()| Name | Path |
|---|---|
Blizzard |
Interface\TargetingFrame\UI-StatusBar |
Blizzard Raid |
Interface\RaidFrame\Raid-Bar-Hp-Fill |
When LibSharedMedia-3.0 is present in the addon environment, RGX-Framework automatically imports its statusbar textures on first access. The import:
- Checks if
LibSharedMedia-3.0is available - Iterates
LSM:HashTable("statusbar") - Registers each entry via
RegisterBar() - Sets category to
"LibSharedMedia" - Only runs once (guarded by
Textures._lsmImportedflag)
To add LSM textures manually at a specific time:
RGX:OnReady(function()
local Textures = RGX:GetTextures()
Textures:ImportLSM()
end)local Textures = RGX:GetTextures()
-- Create a health bar
local bar = CreateFrame("StatusBar", nil, UIParent)
bar:SetSize(200, 20)
bar:SetStatusBarTexture(Textures:GetBar("Blizzard"))
-- Let the user choose
local dropdown = Textures:CreateBarDropdown(configPanel, {
onChange = function(barName)
bar:SetStatusBarTexture(Textures:GetBar(barName))
end,
})