View Single Post
06/12/20, 08:53 PM   #3
QuantumPie
AddOn Author - Click to view addons
Join Date: Sep 2019
Posts: 32
Thanks for getting back to me! I figured that out not long ago after getting a better understanding of CMX. Unfortunately I can't get the textures to display.

The current XML I'm using is:
Lua Code:
  1. <GuiXml>
  2.     <Controls>
  3.         <Control name="BarTracker_Slot" virtual="true">
  4. <!--            <Anchor point="CENTER" relativeTo="$(parent)" relativePoint="CENTER" offsetX="0" offsetY="0"/>-->
  5.             <Controls>
  6.                 <Texture name="$(parent)Tex">
  7.                     <Anchor point="LEFT" relativePoint="LEFT"/>
  8.                     <Dimensions x="50" y="50"/>
  9.                 </Texture>
  10.             </Controls>
  11.         </Control>
  12.  
  13.         <TopLevelControl name="BarTrackerWindow">
  14.             <Dimensions x="250" y="100"/>
  15.             <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="CENTER" offsetX="0" offsetY="0"/>
  16.             <OnMouseEnter>WINDOW_MANAGER:SetMouseCursor(12);</OnMouseEnter>-->
  17.             <OnMouseExit>WINDOW_MANAGER:SetMouseCursor(0);</OnMouseExit>
  18.             <OnMoveStop>BarTracker.savePosition()</OnMoveStop>
  19.             <Controls>
  20.                 <Backdrop name="$(parent)_BG" alpha="1" centerColor="40000000" edgeColor="60000000">
  21.                     <AnchorFill />
  22.                     <Edge edgeSize="1" />
  23.                 </Backdrop>
  24.                 <Control name="$(parent)_Front">
  25.                     <Dimensions x="250" y="100" />
  26.                     <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT"/>
  27.                 </Control>
  28.                 <Control name="$(parent)_Back">
  29.                     <Dimensions x="250" y="100" />
  30.                     <Anchor point="TOPLEFT" relativeTo="$(parent)_Front" relativePoint="TOPLEFT"/>
  31.                 </Control>
  32.             </Controls>
  33.         </TopLevelControl>
  34.     </Controls>
  35. </GuiXml>

And I'm trying to use the virtual via:
Lua Code:
  1. local wm = WINDOW_MANAGER
  2.  
  3. BarTracker = {
  4.     name = "BarTracker",
  5.     author = "QuantumPie",
  6.     version = "0.0.1",
  7.     varsVersion = 1,
  8.     guiWindow = BarTrackerWindow,
  9.     guiBG = BarTrackerWindow_BG,
  10.     guiFront = BarTrackerWindow_Front,
  11.     guiBack = BarTrackerWindow_Back,
  12.     guiTemplate = "BarTracker_Slot",
  13.     wm = WINDOW_MANAGER,
  14.     defaults = {
  15.         fb = {},
  16.         bb = {},
  17.         hidden = false,
  18.         isLocked = false
  19.     }
  20. }
  21.  
  22. ...
  23.  
  24. function BarTracker.initTracker()
  25.     BarTracker.restorePosition()
  26.     BarTracker.updateVisibility()
  27.     for i=1, 1, 1 do
  28.         d("Putting slot")
  29.         local slot = wm:CreateControlFromVirtual("Bar_Slot_" .. i, BarTracker.guiFront, BarTracker.guiTemplate)
  30.         slot:SetAnchor(TOPLEFT, BarTracker.guiFront, TOPLEFT, 0, 0)
  31.         slot:SetHidden(false)
  32.         slot.tex = slot:GetNamedChild("Tex")
  33.         slot.tex:SetTexture("art/icons/ability_templar_purifying_light.dds")
  34.     end
  35. end

Currently I can see the backdrop but the textures aren't displaying. Through DebugLogViewer I can see the print and no errors.
  Reply With Quote