Thread Tools Display Modes
Prev Previous Post   Next Post Next
08/30/23, 11:57 AM   #1
Anna Lee
Join Date: Aug 2023
Posts: 4
Question Display a dds image in the UI

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:
  1. -- Create a custom addon
  2. local addonName = "MyAddon"
  3. local addon = {}
  4.  
  5. -- Event handler for addon initialization
  6. function addon.OnAddOnLoaded(event, loadedAddonName)
  7.     if loadedAddonName == addonName then
  8.        
  9.         addon.InitializeUI()
  10.     end
  11. end
  12.  
  13. -- Function to initialize the UI
  14. function addon.InitializeUI()
  15.     -- Create a control for the image
  16.     local imageControl = WINDOW_MANAGER:CreateControl("MyAddonImage", GuiRoot, CT_TEXTURE)
  17.     imageControl:SetTexture("path/to/the/.dds")
  18.     imageControl:SetDimensions(200, 200)
  19.     imageControl:SetAnchor(CENTER, GuiRoot, CENTER, 0, 0)
  20.     imageControl:SetHidden(false)
  21. end
  22.  
  23. -- Register the event handler
  24. EVENT_MANAGER:RegisterForEvent(addonName, EVENT_ADD_ON_LOADED, addon.OnAddOnLoaded)

txt file:
Lua Code:
  1. ## Title: MyAddon
  2. ## APIVersion: 101036
  3. ## Author: @MyAddon
  4. 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?
Attached Files
File Type: lua MyAddon.lua (792 Bytes, 205 views)
File Type: txt MyAddon.txt (80 Bytes, 201 views)
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » Display a dds image in the UI


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off