View Single Post
05-24-21, 04:47 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Will allow you use the same xml frame in either Classic (era) or BCC or Retail by using the OnLoad script to check is the mixin exists or not.

If the mixin doesn't exist then frames automatically have a Backdrop.

You would also move the <Backdrop...> </Backdrop> into a SetBackdrop call in the OnLoad function after checking for the mixin.

The new xml would look something like (no backdrop inherited):
Code:
<Frame name="LunarWindow" movable="true" toplevel="true" enableMouse="true" hidden="true" parent="UIParent" virtual="true">
	<Size>
		<AbsDimension x="352" y="32"/>
	</Size>
	<Anchors>
		<Anchor point="CENTER" />
	</Anchors>
	<Scripts>	
		<OnLoad inherit="prepend">
			OnLoadFunc(self)
		</OnLoad>
	</Scripts>
</Frame>
The OnLoad function would look solmething like:
Code:
function OnLoadFunc(self)
	if BackdropTemplateMixin then -- if this is NOT a Classic type frame, add the backdrop mixin
		Mixin(self, BackdropTemplateMixin)
	end
	-- setup the backdrop that was in the xml.
	self:Setbackdrop( {
		bgFile = "Interface\\AddOns\\LunarSphere\\art\\Window-Background",
		edgeFile = "Interface\\Addons\\LunarSphere\\art\\Window-Border",
		tile = true,
		tileEdge = false,
		tileSize = 128,
		edgeSize = 16,
		insets = { left = 5, right = 5, top = 5, bottom = 5 }
	} )
end
__________________
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 05:13 PM.
  Reply With Quote