Hi. I’m trying to get a dds image into the ingame UI, but I can’t get it to work. Tried multiple versions of lua. and xml. codes.
At the end I ended up with this lua (see attachment):
Lua Code:
-- Create a custom addon
local addonName = "MyAddon"
local addon = {}
-- Event handler for addon initialization
function addon.OnAddOnLoaded(event, loadedAddonName)
if loadedAddonName == addonName then
addon.InitializeUI()
end
end
-- Function to initialize the UI
function addon.InitializeUI()
-- Create a control for the image
local imageControl = WINDOW_MANAGER:CreateControl("MyAddonImage", GuiRoot, CT_TEXTURE)
imageControl:SetTexture("path/to/the/.dds")
imageControl:SetDimensions(200, 200)
imageControl:SetAnchor(CENTER, GuiRoot, CENTER, 0, 0)
imageControl:SetHidden(false)
end
-- Register the event handler
EVENT_MANAGER:RegisterForEvent(addonName, EVENT_ADD_ON_LOADED, addon.OnAddOnLoaded)
txt file:
Lua Code:
## Title: MyAddon
## APIVersion: 101036
## Author: @MyAddon
MyAddon.lua
I get no error messages with this, but the image isn’t showing either.
Is there something I’m missing out or is the code itself straight up completely false?