View Single Post
05-24-21, 09:32 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
First decision. Do you want to make seperate xml frames for classic and non-classic

If yes then:
Classic: (same as always)
Lua Code:
  1. <Frame name="TestFrame" parent="UIParent">
  2.     <Size x="300" y="300"/>
  3.     <Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
  4.         <BackgroundInsets>
  5.             <AbsInset left="5" right="5" top="5" bottom="5"/>
  6.         </BackgroundInsets>
  7.         <TileSize>
  8.             <AbsValue val="16"/>
  9.         </TileSize>
  10.         <EdgeSize>
  11.             <AbsValue val="16"/>
  12.         </EdgeSize>
  13.     </Backdrop>    
  14.     <Anchors>
  15.         <Anchor point="CENTER"/>
  16.     </Anchors>
  17.     <Scripts>
  18.         <OnLoad inherit="prepend">
  19.             self:SetBackdropColor(0.5, 0.3, 0.3)
  20.             self:SetBackdropBorderColor(0.5, 0.3, 0.3, 0.25)
  21.             print("Loaded!");
  22.         </OnLoad>
  23.     </Scripts>
  24. </Frame>
Others, Mostly the same xml frame but inherits the BackdropTemplate and all backdrop information is set in lua (OnLoad)
Lua Code:
  1. <Frame name="TestFrame" parent="UIParent" inherits="BackdropTemplate">
  2.     <Size x="300" y="300"/>
  3.     <Anchors>
  4.         <Anchor point="CENTER"/>
  5.     </Anchors>
  6.     <Scripts>
  7.         <OnLoad inherit="prepend">
  8.             self:SetBackdrop( {
  9.                 bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
  10.                 edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  11.                 tile = true,
  12.                 tileEdge = true,
  13.                 tileSize = 16,
  14.                 edgeSize = 16,
  15.                 insets = { left = 5, right = 5, top = 5, bottom = 5 }
  16.             })
  17.             self:SetBackdropColor(0.5, 0.3, 0.3)
  18.             self:SetBackdropBorderColor(0.5, 0.3, 0.3, 0.25)
  19.             print("Loaded!");
  20.         </OnLoad>
  21.     </Scripts>
  22. </Frame>

Or, do you want one frame for both Classic and the rest: Mostly the same xml frame but detecting if backdrop mixin (template) is needed and all backdrop information is set in lua (OnLoad)
Lua Code:
  1. <Frame name="TestFrame" parent="UIParent">
  2.     <Size x="300" y="300"/>
  3.     <Anchors>
  4.         <Anchor point="CENTER"/>
  5.     </Anchors>
  6.     <Scripts>
  7.         <OnLoad inherit="prepend">
  8.             if BackdropTemplateMixin then -- if this is NOT a Classic type frame, add the backdrop mixin
  9.                 Mixin(self, BackdropTemplateMixin)
  10.             end
  11.             self:SetBackdrop( {
  12.                 bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
  13.                 edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  14.                 tile = true,
  15.                 tileEdge = true,
  16.                 tileSize = 16,
  17.                 edgeSize = 16,
  18.                 insets = { left = 5, right = 5, top = 5, bottom = 5 }
  19.             })
  20.             self:SetBackdropColor(0.5, 0.3, 0.3)
  21.             self:SetBackdropBorderColor(0.5, 0.3, 0.3, 0.25)
  22.             print("Loaded!");
  23.         </OnLoad>
  24.     </Scripts>
  25. </Frame>
Done this way to show separation of xml and lua. With the Classic and non-Classic you could use <KeyValues></KeyValues> for both but not with the one frame for multiple versions layout.

Definitions like BACKDROP_TOOLTIP_16_16_5555 and LEGENDARY_ORANGE_COLOR don't exist in Classic and may not BCC either so probably easiest not to use them and just define backdrop, colours, alpha manually in both.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-24-21 at 09:42 PM.
  Reply With Quote