Class Element
This class represents a generic base class for ui elements of a UiSystem.
public abstract class Element : GenericDataHolder, IGenericDataHolder
- Inheritance
-
Element
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
Element(Anchor, Vector2)
Creates a new element with the given anchor and size and sets up some default event reactions.
protected Element(Anchor anchor, Vector2 size)
Parameters
Fields
ActionSound
A style property that contains the sound effect that is played when this element's OnPressed is called
public StyleProp<SoundEffectInfo> ActionSound
Field Value
Children
A list of all of this element's direct children. Use AddChild<T>(T, int) or RemoveChild(Element) to manipulate this list while calling all of the necessary callbacks.
public readonly IList<Element> Children
Field Value
Controls
The controls that this element's System uses
public UiControls Controls
Field Value
Epsilon
This field holds an epsilon value used in element Size, position and resulting Area calculations to mitigate floating point rounding inaccuracies. If ui elements used are extremely small or extremely large, this value can be reduced or increased.
public static float Epsilon
Field Value
GetGamepadNextElement
Event that is called when the next element to select when using gamepad input is calculated. To cause a different element than the default one to be selected, return it during this event.
public Element.GamepadNextElementCallback GetGamepadNextElement
Field Value
GetTabNextElement
Event that is called when the next element to select when pressing tab is calculated. To cause a different element than the default one to be selected, return it during this event.
public Element.TabNextElementCallback GetTabNextElement
Field Value
MouseEnterAnimation
A UiAnimation that is played when the mouse enters this element, in OnMouseEnter.
public StyleProp<UiAnimation> MouseEnterAnimation
Field Value
MouseExitAnimation
A UiAnimation that is played when the mouse exits this element, in OnMouseExit.
public StyleProp<UiAnimation> MouseExitAnimation
Field Value
OnAddedToUi
Event that is called when this element is added to a UiSystem, that is, when this element's System is set to a non-null value.
public Element.GenericCallback OnAddedToUi
Field Value
OnAreaUpdated
Event that is called when this element's DisplayArea is changed.
public Element.GenericCallback OnAreaUpdated
Field Value
OnChildAdded
Event that is called when a child is added to this element using AddChild<T>(T, int) Note that, while this event is only called for immediate children of this element, OnElementAdded is called for all children and grandchildren.
public Element.OtherElementCallback OnChildAdded
Field Value
OnChildRemoved
Event that is called when a child is removed from this element using RemoveChild(Element). Note that, while this event is only called for immediate children of this element, OnElementRemoved is called for all children and grandchildren.
public Element.OtherElementCallback OnChildRemoved
Field Value
OnDeselected
Event that is called when this element's IsSelected is turned false
public Element.GenericCallback OnDeselected
Field Value
OnDrawn
Event that is called after this element is drawn, but before its children are drawn
public Element.DrawCallback OnDrawn
Field Value
OnMouseEnter
Event that is called when this element starts being moused over
public Element.GenericCallback OnMouseEnter
Field Value
OnMouseExit
Event that is called when this element stops being moused over
public Element.GenericCallback OnMouseExit
Field Value
OnMousedElementChanged
Event that is called when the element that is currently being moused changes within the ui system. Note that the event fired doesn't necessarily correlate to this specific element.
public Element.OtherElementCallback OnMousedElementChanged
Field Value
OnPressed
Event that is called when this element is pressed
public Element.GenericCallback OnPressed
Field Value
OnRemovedFromUi
Event that is called when this element is removed from a UiSystem, that is, when this element's System is set to null.
public Element.GenericCallback OnRemovedFromUi
Field Value
OnSecondaryPressed
Event that is called when this element is pressed using the secondary action
public Element.GenericCallback OnSecondaryPressed
Field Value
OnSelected
Event that is called when this element's IsSelected is turned true
public Element.GenericCallback OnSelected
Field Value
OnSelectedElementChanged
Event that is called when the element that is currently selected changes within the ui system. Note that the event fired doesn't necessarily correlate to this specific element.
public Element.OtherElementCallback OnSelectedElementChanged
Field Value
OnStyleInit
Event that is called when this element's InitStyle(UiStyle) method is called while setting the Style.
public Element.GenericCallback OnStyleInit
Field Value
OnTextInput
Event that is called when text input is made. When an element uses this event, it should call EnsureExists() on construction to ensure that the MLEM platform is initialized. Note that this event is called for every element, even if it is not selected. Also note that if the active MlemPlatform uses an on-screen keyboard, this event is never called.
public Element.TextInputCallback OnTextInput
Field Value
OnTouchEnter
Event that is called when this element starts being touched
public Element.GenericCallback OnTouchEnter
Field Value
OnTouchExit
Event that is called when this element stops being touched
public Element.GenericCallback OnTouchExit
Field Value
OnTouchedElementChanged
Event that is called when the element that is currently being touched changes within the ui system. Note that the event fired doesn't necessarily correlate to this specific element.
public Element.OtherElementCallback OnTouchedElementChanged
Field Value
OnUpdated
Event that is called when this element is updated
public Element.TimeCallback OnUpdated
Field Value
Padding
The padding that this element has. The padding is subtracted from the element's Size, and it is an area that the element does not extend into. This means that this element's resulting DisplayArea does not include this padding.
public StyleProp<Padding> Padding
Field Value
PlayingAnimations
A list of all of the UiAnimation instances that are currently playing. You can modify this collection through PlayAnimation(UiAnimation) and StopAnimation(UiAnimation).
protected readonly List<UiAnimation> PlayingAnimations
Field Value
ScrollOffset
The offset that this element has as a result of Panel scrolling.
public Vector2 ScrollOffset
Field Value
- Vector2
SecondActionSound
A style property that contains the sound effect that is played when this element's OnSecondaryPressed is called
public StyleProp<SoundEffectInfo> SecondActionSound
Field Value
SelectionIndicator
A style property that contains the selection indicator that is displayed on this element if it is the SelectedElement
public StyleProp<NinePatch> SelectionIndicator
Field Value
Transform
This element's transform matrix.
Can easily be scaled using ScaleTransform(float, Vector2?).
Note that, when this is non-null, a new SpriteBatch.Begin
call is used for this element.
public Matrix Transform
Field Value
- Matrix
Properties
Anchor
The Anchor that this element uses for positioning within its parent
public Anchor Anchor { get; set; }
Property Value
Area
The UnscrolledArea of this element, but with ScaledScrollOffset applied.
public RectangleF Area { get; }
Property Value
AreaDirty
Returns whether this element's SetAreaDirty() method has been recently called and its area has not been updated since then using UpdateAreaIfDirty() or ForceUpdateArea().
public bool AreaDirty { get; }
Property Value
AutoNavGroup
An optional string that represents a group of elements for automatic (keyboard and gamepad) navigation. All elements that share the same auto-nav group will be able to be navigated between, and all other elements will not be reachable from elements of other groups. Note that, if no element is previously selected and auto-navigation is invoked, this element cannot be chosen as the first element to navigate to if its auto-nav group is non-null.
public virtual string AutoNavGroup { get; set; }
Property Value
AutoSizeAddedAbsolute
If auto-sizing is used by setting Size less than or equal to 1, this property allows adding or subtracting an additional, absolute value from the automatically calculated size. If this element is not using auto-sizing, this property is ignored.
public Vector2 AutoSizeAddedAbsolute { get; set; }
Property Value
- Vector2
Examples
Ignoring Scale, if this element's Size is set to 0.5, 0.75
and its Parent has a size of 200, 100
, then an added absolute size of -50, 25
will result in a final Area size of 0.5 * 200 - 50, 0.75 * 100 + 25
, or 50, 100
.
CanAutoAnchorsAttach
Set this field to false to cause auto-anchored siblings to ignore this element as a possible anchor point.
public virtual bool CanAutoAnchorsAttach { get; set; }
Property Value
CanBeMoused
Set this field to false to disallow the element from reacting to being moused over.
public virtual bool CanBeMoused { get; set; }
Property Value
CanBePressed
Set this field to false to disallow this element's OnPressed and OnSecondaryPressed events to be called.
public virtual bool CanBePressed { get; set; }
Property Value
CanBeSelected
Set this field to false to disallow the element from being selected. An unselectable element is skipped by automatic navigation and its OnSelected callback will never be called.
public virtual bool CanBeSelected { get; set; }
Property Value
ChildPaddedArea
This element's current Area, but with ScaledChildPadding applied.
public RectangleF ChildPaddedArea { get; }
Property Value
ChildPadding
The child padding that this element has. The child padding moves any Children added to this element inwards by the given amount in each direction.
public StyleProp<Padding> ChildPadding { get; set; }
Property Value
DisplayArea
The area that this element is displayed in, which is Area shrunk by this element's ScaledPadding. This is the property that should be used for drawing this element, as well as mouse input handling and culling.
public RectangleF DisplayArea { get; }
Property Value
DrawAlpha
The transparency (alpha value) that this element is rendered with. Note that, when Draw(GameTime, SpriteBatch, float, SpriteBatchContext) is called, this alpha value is multiplied with the Parent's alpha value and passed down to this element's Children.
public virtual float DrawAlpha { get; set; }
Property Value
Input
The input handler that this element's Controls use
protected InputHandler Input { get; }
Property Value
IsHidden
Set this property to true
to cause this element to be hidden.
Hidden elements don't receive input events, aren't rendered and don't factor into auto-anchoring.
public virtual bool IsHidden { get; set; }
Property Value
IsMouseOver
Stores whether this element is currently being moused over or touched.
public bool IsMouseOver { get; }
Property Value
IsSelected
Returns whether this element is its Root's SelectedElement. Note that, unlike IsSelectedActive, this property will be true even if this element's Root is not the ActiveRoot.
public bool IsSelected { get; }
Property Value
IsSelectedActive
Returns whether this element is its Controls's SelectedElement. Note that IsSelected can be used to query whether this element is its Root's SelectedElement instead.
public bool IsSelectedActive { get; }
Property Value
Parent
This element's parent element.
If this element has no parent (it is the RootElement of a ui system), this value is null
.
public Element Parent { get; }
Property Value
ParentArea
The ChildPaddedArea of this element's Parent, or the Viewport if this element has no parent. This value is the one that is passed to CalcActualSize(RectangleF) during ForceUpdateArea().
protected RectangleF ParentArea { get; }
Property Value
PositionOffset
This element's offset from its default position, which is dictated by its Anchor. Note that, depending on the side that the element is anchored to, this offset moves it in a different direction.
public Vector2 PositionOffset { get; set; }
Property Value
- Vector2
PreventParentSpill
Set this field to true to cause this element's final display area to never exceed that of its Parent. If the resulting area is too large, the size of this element is shrunk to fit the target area. This can be useful if an element should fill the remaining area of a parent exactly.
public virtual bool PreventParentSpill { get; set; }
Property Value
Priority
The priority of this element as part of its Parent element. A higher priority means the element will be drawn first, but not anchored higher up if auto-anchoring is used.
public int Priority { get; set; }
Property Value
Root
This element's RootElement. Note that this value is set even if this element has a Parent. To get the element that represents the root element, use Element.
public RootElement Root { get; }
Property Value
Scale
The scale that this ui element renders with
public float Scale { get; }
Property Value
ScaledAutoSizeAddedAbsolute
The AutoSizeAddedAbsolute, but with Scale applied.
public Vector2 ScaledAutoSizeAddedAbsolute { get; }
Property Value
- Vector2
ScaledChildPadding
The ChildPadding, but with Scale applied.
public Padding ScaledChildPadding { get; }
Property Value
ScaledOffset
The PositionOffset, but with Scale applied.
public Vector2 ScaledOffset { get; }
Property Value
- Vector2
ScaledPadding
public Padding ScaledPadding { get; }
Property Value
ScaledScrollOffset
The ScrollOffset, but with Scale applied.
public Vector2 ScaledScrollOffset { get; }
Property Value
- Vector2
ScaledSize
public Vector2 ScaledSize { get; }
Property Value
- Vector2
SetHeightBasedOnChildren
Set this field to true to cause this element's height to be automatically calculated based on the area that its Children take up. To use this element's Size's Y coordinate as a minimum or maximum height rather than ignoring it, set TreatSizeAsMinimum or TreatSizeAsMaximum to true.
public virtual bool SetHeightBasedOnChildren { get; set; }
Property Value
SetWidthBasedOnChildren
Set this field to true to cause this element's width to be automatically calculated based on the area that its Children take up. To use this element's Size's X coordinate as a minimum or maximum width rather than ignoring it, set TreatSizeAsMinimum or TreatSizeAsMaximum to true.
public virtual bool SetWidthBasedOnChildren { get; set; }
Property Value
Size
The size of this element, where X represents the width and Y represents the height. If the x or y value of the size is between 0 and 1, the size will be seen as a percentage of its parent's size rather than as an absolute value. If the x (or y) value of the size is negative, the width (or height) is seen as a percentage of the element's resulting height (or width). Additionally, if auto-sizing is used, AutoSizeAddedAbsolute can be set to add or subtract an absolute value from the automatically calculated size.
public Vector2 Size { get; set; }
Property Value
- Vector2
Examples
The following example, ignoring Scale, combines both types of percentage-based sizing.
If this element is inside of a Parent whose width is 20, this element's width will be set to 0.5 * 20 = 10
, and its height will be set to 2.5 * 10 = 25
.
element.Size = new Vector2(0.5F, -2.5F);
SortedChildren
protected IList<Element> SortedChildren { get; }
Property Value
Style
This Element's current UiStyle. When this property is set, InitStyle(UiStyle) is called.
public StyleProp<UiStyle> Style { get; set; }
Property Value
System
The ui system that this element is currently a part of
public UiSystem System { get; }
Property Value
TreatSizeAsMaximum
If this field is set to true, and SetWidthBasedOnChildren or SetHeightBasedOnChildrenare enabled, the resulting width or height weill always be less than or equal to this element's Size. Note that this value only has an effect if SetWidthBasedOnChildren or SetHeightBasedOnChildren are enabled.
public virtual bool TreatSizeAsMaximum { get; set; }
Property Value
TreatSizeAsMinimum
If this field is set to true, and SetWidthBasedOnChildren or SetHeightBasedOnChildren are enabled, the resulting width or height will always be greather than or equal to this element's Size. For example, if an element's Size's Y coordinate is set to 20, but there is only one child with a height of 10 in it, the element's height would be shrunk to 10 if this value was false, but would remain at 20 if it was true. Note that this value only has an effect if SetWidthBasedOnChildren or SetHeightBasedOnChildren are enabled.
public virtual bool TreatSizeAsMinimum { get; set; }
Property Value
UnscrolledArea
This element's area, without respecting its ScrollOffset. This area is updated automatically to fit this element's sizing and positioning properties.
public RectangleF UnscrolledArea { get; }
Property Value
Methods
AddChild<T>(T, int)
Adds a child to this element.
public virtual T AddChild<T>(T element, int index = -1) where T : Element
Parameters
element
TThe child element to add
index
intThe index to add the child at, or -1 to add it to the end of the Children list
Returns
- T
This element, for chaining
Type Parameters
T
The type of child to add
AddedToUi(UiSystem, RootElement)
Called when this element is added to a UiSystem and, optionally, a given RootElement. This method is called in AddChild<T>(T, int) and Add(string, Element).
protected virtual void AddedToUi(UiSystem system, RootElement root)
Parameters
system
UiSystemThe ui system to add to.
root
RootElementThe root element to add to.
AndChildren(Action<Element>)
Performs the specified action on this element and all of its Children
public void AndChildren(Action<Element> action)
Parameters
CalcActualSize(RectangleF)
Calculates the actual size that this element should take up, based on the area that its parent encompasses. By default, this is based on the information specified in Size's documentation.
protected virtual Vector2 CalcActualSize(RectangleF parentArea)
Parameters
parentArea
RectangleFThis parent's area, or the ui system's viewport if it has no parent
Returns
- Vector2
The actual size of this element, taking Scale into account
Draw(GameTime, SpriteBatch, float, SpriteBatchContext)
Draws this element and all of its children. Override this method to draw the content of custom elements.
Note that, when this is called, SpriteBatch.Begin
has already been called with custom Transform etc. applied.
public virtual void Draw(GameTime time, SpriteBatch batch, float alpha, SpriteBatchContext context)
Parameters
time
GameTimeThe game's time
batch
SpriteBatchThe sprite batch to use for drawing
alpha
floatThe alpha to draw this element and its children with
context
SpriteBatchContextThe sprite batch context to use for drawing
DrawTransformed(GameTime, SpriteBatch, float, SpriteBatchContext)
Draws this element by calling Draw(GameTime, SpriteBatch, float, SpriteBatchContext) internally.
If Transform is set, a new SpriteBatch.Begin
call is also started.
public void DrawTransformed(GameTime time, SpriteBatch batch, float alpha, SpriteBatchContext context)
Parameters
time
GameTimeThe game's time
batch
SpriteBatchThe sprite batch to use for drawing
alpha
floatThe alpha to draw this element and its children with
context
SpriteBatchContextThe sprite batch context to use for drawing
ForceUpdateArea()
Forces this element's Area to be updated if it is not IsHidden. This method also updates all of this element's Children's areas.
public virtual void ForceUpdateArea()
ForceUpdateSortedChildren()
Forces an update of the SortedChildren list.
public virtual void ForceUpdateSortedChildren()
GetAreaForAutoAnchors()
Returns the area that should be used for determining where auto-anchoring children should attach.
protected virtual RectangleF GetAreaForAutoAnchors()
Returns
- RectangleF
The area for auto anchors
GetChildren(Func<Element, bool>, bool, bool)
Returns all of this element's children of the given type that match the given condition. Optionally, the entire tree of children (grandchildren) can be searched.
public IEnumerable<Element> GetChildren(Func<Element, bool> condition = null, bool regardGrandchildren = false, bool ignoreFalseGrandchildren = false)
Parameters
condition
Func<Element, bool>The condition to match
regardGrandchildren
boolIf this value is true, children of children of this element are also searched
ignoreFalseGrandchildren
boolIf this value is true, children for which the condition does not match will not have their children searched
Returns
- IEnumerable<Element>
All children that match the condition
GetChildren<T>(Func<T, bool>, bool, bool)
Returns all of this element's children of the given type that match the given condition. Optionally, the entire tree of children (grandchildren) can be searched.
public IEnumerable<T> GetChildren<T>(Func<T, bool> condition = null, bool regardGrandchildren = false, bool ignoreFalseGrandchildren = false) where T : Element
Parameters
condition
Func<T, bool>The condition to match
regardGrandchildren
boolIf this value is true, children of children of this element are also searched
ignoreFalseGrandchildren
boolIf this value is true, children for which the condition does not match will not have their children searched
Returns
- IEnumerable<T>
All children that match the condition
Type Parameters
T
The type of children to search for
GetElementUnderPos(Vector2)
Returns the element under the given position, searching the current element and all of its GetRelevantChildren().
public virtual Element GetElementUnderPos(Vector2 position)
Parameters
position
Vector2The position to query
Returns
- Element
The element under the position, or null if no such element exists
GetLowestChild(Func<Element, bool>, bool)
Returns this element's lowest child element (in terms of y position) that matches the given condition.
public Element GetLowestChild(Func<Element, bool> condition = null, bool total = false)
Parameters
condition
Func<Element, bool>The condition to match
total
boolWhether to evaluate based on the child's GetTotalCoveredArea(bool), rather than its UnscrolledArea.
Returns
- Element
The lowest element, or null if no such element exists
GetLowestOlderSibling(Func<Element, bool>, bool)
Returns this element's lowest sibling that is also older (lower in its parent's Children list) than this element that also matches the given condition. The returned element's Parent will always be equal to this element's Parent.
public Element GetLowestOlderSibling(Func<Element, bool> condition = null, bool total = false)
Parameters
condition
Func<Element, bool>The condition to match
total
boolWhether to evaluate based on the child's GetTotalCoveredArea(bool), rather than its UnscrolledArea.
Returns
- Element
The lowest older sibling of this element, or null if no such element exists
GetOlderSibling(Func<Element, bool>)
Returns this element's first older sibling that matches the given condition. The returned element's Parent will always be equal to this element's Parent.
public Element GetOlderSibling(Func<Element, bool> condition = null)
Parameters
Returns
- Element
The older sibling, or null if no such element exists
GetParentTree()
Returns the parent tree of this element. The parent tree is this element's Parent, followed by its parent, and so on, up until the RootElement's Element.
public IEnumerable<Element> GetParentTree()
Returns
- IEnumerable<Element>
This element's parent tree
GetRelevantChildren()
Returns a subset of Children that are currently relevant in terms of drawing and input querying. A Panel only returns elements that are currently in view here.
protected virtual IList<Element> GetRelevantChildren()
Returns
GetRightmostChild(Func<Element, bool>, bool)
Returns this element's rightmost child (in terms of x position) that matches the given condition.
public Element GetRightmostChild(Func<Element, bool> condition = null, bool total = false)
Parameters
condition
Func<Element, bool>The condition to match
total
boolWhether to evaluate based on the child's GetTotalCoveredArea(bool), rather than its UnscrolledArea.
Returns
- Element
The rightmost element, or null if no such element exists
GetSiblings(Func<Element, bool>)
Returns all of this element's siblings that match the given condition. Siblings are elements that have the same Parent as this element.
public IEnumerable<Element> GetSiblings(Func<Element, bool> condition = null)
Parameters
Returns
- IEnumerable<Element>
This element's siblings
GetTotalCoveredArea(bool)
Returns the total covered area of this element, which is its Area (or UnscrolledArea), unioned with all of the total covered areas of its Children. The returned area is only different from this element's Area (or UnscrolledArea) if it has any Children that are outside of this element's area, or are bigger than this element.
public RectangleF GetTotalCoveredArea(bool unscrolled)
Parameters
unscrolled
boolWhether to use elements' UnscrolledArea (instead of their Area).
Returns
- RectangleF
This element's total covered area.
InitStyle(UiStyle)
Initializes this element's StyleProp<T> instances using the ui system's UiStyle.
protected virtual void InitStyle(UiStyle style)
Parameters
style
UiStyleThe new style
OnChildAreaDirty(Element, bool)
A method that gets called by this element's Children or any of its grandchildren when their SetAreaDirty() methods get called. Note that the element's area might already be dirty, which will not stop this method from being called.
protected virtual void OnChildAreaDirty(Element child, bool grandchild)
Parameters
child
ElementThe child whose area is being set dirty.
grandchild
boolWhether the
child
is a grandchild of this element, rather than a direct child.
PlayAnimation(UiAnimation)
Plays the given UiAnimation on this element, causing it to be added to the PlayingAnimations and updated in Update(GameTime).
If the given animation
is already playing on this element, it will be restarted.
public virtual void PlayAnimation(UiAnimation animation)
Parameters
animation
UiAnimationThe animation to play.
RemoveChild(Element)
Removes the given child from this element.
public virtual void RemoveChild(Element element)
Parameters
element
ElementThe child element to remove
RemoveChildren(Func<Element, bool>)
Removes all children from this element that match the given condition.
public virtual void RemoveChildren(Func<Element, bool> condition = null)
Parameters
RemovedFromUi()
Called when this element is removed from a UiSystem and RootElement. This method is called in RemoveChild(Element) and Remove(string).
protected virtual void RemovedFromUi()
ReorderChildren(Comparison<Element>)
Sorts this element's Children using the given comparison.
public void ReorderChildren(Comparison<Element> comparison)
Parameters
comparison
Comparison<Element>The comparison to sort by
ReverseChildren(int, int?)
Reverses this element's Children list in the given range.
public void ReverseChildren(int index = 0, int? count = null)
Parameters
ScaleTransform(float, Vector2?)
Scales this element's Transform matrix based on the given scale and origin.
public void ScaleTransform(float scale, Vector2? origin = null)
Parameters
scale
floatThe scale to use
origin
Vector2?The origin to use for scaling, or null to use this element's center point
SetAreaAndUpdateChildren(RectangleF)
Sets this element's Area to the given RectangleF and invokes the OnElementAreaUpdated event. This method also updates all of this element's Children's areas. Note that this method does not take into account any auto-sizing, anchoring or positioning, and so it should be used sparingly, if at all.
public virtual void SetAreaAndUpdateChildren(RectangleF area)
Parameters
area
RectangleF
- See Also
SetAreaDirty()
Causes this element's Area to be recalculated as soon as possible. If this element is auto-anchored or its parent automatically changes its size based on its children, this element's parent's area is also marked dirty.
public void SetAreaDirty()
SetSortedChildrenDirty()
Causes SortedChildren to be recalculated as soon as possible.
public void SetSortedChildrenDirty()
StopAnimation(UiAnimation)
Stops the given UiAnimation on this element, causing it to be removed from the PlayingAnimations and OnFinished(Element) to be invoked.
public virtual bool StopAnimation(UiAnimation animation)
Parameters
animation
UiAnimationThe animation to stop.
Returns
- bool
Whether the animation was present in this element's PlayingAnimations.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
TransformInverse(Vector2)
Transforms the given position
by the inverse of this element's Transform matrix.
protected Vector2 TransformInverse(Vector2 position)
Parameters
position
Vector2The position to transform
Returns
- Vector2
The transformed position
TransformInverseAll(Vector2)
Transforms the given position
by this element's Root's InvTransform, the inverses of all of the Transform matrices of this element's parent tree (GetParentTree()), and the inverse of this element's Transform matrix.
Note that, when using GetElementUnderPos(Vector2), this operation is done recursively, which is more efficient.
protected Vector2 TransformInverseAll(Vector2 position)
Parameters
position
Vector2The position to transform
Returns
- Vector2
The transformed position
Update(GameTime)
Updates this element and all of its SortedChildren
public virtual void Update(GameTime time)
Parameters
time
GameTimeThe game's time
UpdateAreaIfDirty()
Updates this element's Area and all of its Children by calling ForceUpdateArea() if AreaDirty is true.
public bool UpdateAreaIfDirty()
Returns
- bool
Whether AreaDirty was true and ForceUpdateArea() was called
UpdateSortedChildrenIfDirty()
Updates the SortedChildren list if SetSortedChildrenDirty() is true.
public void UpdateSortedChildrenIfDirty()