Class Node
- Namespace
- Fantas
- Assembly
- Fantas.dll
Base Node for other Nodes
public class Node
- Inheritance
-
Node
- Derived
- Inherited Members
Constructors
Node()
Create a generic node Usually used as parent for other nodes
public Node()
Node(Node)
Copy the node
public Node(Node other)
Parameters
other
Node
Properties
Alpha
Transparency applied to the node and children's
public float Alpha { get; set; }
Property Value
Bottom
Bottom side of Node frame NOTICE: The Bottom of frame is different from node.Frame.Bottom, this happens because System.Drawing.Rectangle assumes Top is always lower than Bottom (when set, will move the node position without affect the size)
public float Bottom { get; set; }
Property Value
CanBringForward
True if node can be brought forward among siblings
public bool CanBringForward { get; }
Property Value
CanSendBackward
True if node can be sent backward among siblings
public bool CanSendBackward { get; }
Property Value
Center
Center location of Node
public PointF Center { get; set; }
Property Value
Children
Children add to this node
public Node[] Children { get; }
Property Value
- Node[]
Cursor
Custom mouse cursor for node
public Cursor Cursor { get; set; }
Property Value
Frame
Node Frame without children
public RectangleF Frame { get; }
Property Value
HasAnimation
Check if not is running animations
public bool HasAnimation { get; }
Property Value
HasChildren
Return whether this node has children
public bool HasChildren { get; }
Property Value
HasParent
Return whether this node has children
public bool HasParent { get; }
Property Value
Height
Node height
public float Height { get; }
Property Value
Hidden
Node visibility (when is hidden)
public bool Hidden { get; set; }
Property Value
IsHitTestEnabled
Flag to control if Node can be hit-test by Mouse/Touch node events
public bool IsHitTestEnabled { get; set; }
Property Value
IsMouseOver
True if the mouse cursor position is over the node
public bool IsMouseOver { get; }
Property Value
IsTouchOver
True if Node is current being touch
public bool IsTouchOver { get; }
Property Value
Left
Left side of Node frame (when set, will move the node position without affect the size)
public float Left { get; set; }
Property Value
MouseButtonPressed
Mouse button that was pressed over the node
public MouseButtons MouseButtonPressed { get; }
Property Value
Name
optional name of the node
public string Name { get; set; }
Property Value
Parent
Parent node
public Node Parent { get; }
Property Value
Paused
Pause animation of node (and children)
public bool Paused { get; set; }
Property Value
PhysicsBody
PhysicsBody of node.
public PhysicsBody PhysicsBody { get; set; }
Property Value
Position
Position relative to the parent node
public PointF Position { get; set; }
Property Value
Right
Right side of Node frame (when set, will move the node position without affect the size)
public float Right { get; set; }
Property Value
Scale
Node scale factor
public Vector2 Scale { get; set; }
Property Value
Scene
Get the scene the node was added
public Scene Scene { get; }
Property Value
Speed
Controls the animation speed of node (and children)
public float Speed { get; set; }
Property Value
Tag
User defined value to store custom information about this node.
public object Tag { get; set; }
Property Value
Top
Top side of Node frame NOTICE: The Top of frame is different from node.Frame.Top, this happens because System.Drawing.Rectangle assumes Top is always lower than Bottom (when set, will move the node position without affect the size)
public float Top { get; set; }
Property Value
TouchCount
Total of current touches within the Node frame
public int TouchCount { get; }
Property Value
Width
Node width
public float Width { get; }
Property Value
X
X position of Node
public float X { get; set; }
Property Value
XScale
X scale factor
public float XScale { get; set; }
Property Value
Y
Y position of Node
public float Y { get; set; }
Property Value
YScale
Y scale factor
public float YScale { get; set; }
Property Value
ZPosition
Node Z offset (0-bottom, + closer to camera)
public float ZPosition { get; set; }
Property Value
ZRotation
Z-rotation (euler angle) using anchor as pivot
public double ZRotation { get; set; }
Property Value
Methods
AddChild(Node)
Add a new child node
public void AddChild(Node child)
Parameters
child
Node
BringForward()
Move node forward inside parent children
public void BringForward()
BringToFront()
Move node to the front in the among siblings
public void BringToFront()
CalculateAccumulatedFrame()
Calculate the frame of this node and all children
public RectangleF CalculateAccumulatedFrame()
Returns
ContainsPoint(PointF)
Check if the point is inside the node frame
public bool ContainsPoint(PointF point)
Parameters
point
PointFpoint in parent coordinates
Returns
- bool
Return true if the node frame contains the point
ConvertPointFromNode(PointF, Node)
Transform point from the from source node to this node
public PointF ConvertPointFromNode(PointF point, Node sourceNode)
Parameters
Returns
- PointF
Return point converted from reference
ConvertPointToNode(PointF, Node)
Transform point from the from this node to another node
public PointF ConvertPointToNode(PointF point, Node toNode)
Parameters
Returns
- PointF
Return point converted to reference node
Copy()
Copy this node
protected virtual Node Copy()
Returns
GetAnimationForKey(string)
Get the animation for the key
public Animation GetAnimationForKey(string key)
Parameters
key
stringKey used on RunAnimation
Returns
- Animation
Return the animation associated with key or null if wasn't found
GetChildNode(string)
Search a child node with the given name
public Node GetChildNode(string childName)
Parameters
childName
stringname of child
Returns
- Node
Return node with the given name, or null if wasn't found
GetNodeAtPoint(PointF)
Get the top visible node from the point
public Node GetNodeAtPoint(PointF point)
Parameters
point
PointF
Returns
- Node
Return the first visible node that intersect the point
GetNodesAtPoint(PointF)
Get the list of visible nodes at the point
public Node[] GetNodesAtPoint(PointF point)
Parameters
point
PointFpoint in parent coordinates
Returns
- Node[]
List of node that intersect the point
HasAnimationKey(string)
Check wheter the node has an animation with the given key
public bool HasAnimationKey(string key)
Parameters
key
string
Returns
InParentHierarchy(Node)
Check if the node is in the hierarchy under other node
public bool InParentHierarchy(Node other)
Parameters
other
Node
Returns
InsertChild(int, Node)
Insert a child into the index position
public void InsertChild(int index, Node child)
Parameters
IntersectsNode(Node)
Check if one node overlaps with the other
public bool IntersectsNode(Node other)
Parameters
other
NodeOther node
Returns
- bool
Return true if node frame intersects with other node frame
LookAt(PointF)
Rotate node facing target point
public void LookAt(PointF target)
Parameters
target
PointF
MoveToParent(Node)
Change node parent
public void MoveToParent(Node newParent)
Parameters
newParent
Node
Offset(Vector2)
Offset node to a new position
public void Offset(Vector2 delta)
Parameters
delta
Vector2
Offset(float, float)
Offset node to a new position
public void Offset(float x, float y)
Parameters
OffsetX(float)
Offset node horizontally
public void OffsetX(float delta)
Parameters
delta
float
OffsetY(float)
Offset node vertically
public void OffsetY(float delta)
Parameters
delta
float
OnClick(MouseEventArgs)
Called when mouse left button clicked within the children node (called after left button down, left button up) call back contains the node clicked and the point (scene coordinates) Don't override from Scene, use OnMouseButtonDown instead
public virtual void OnClick(MouseEventArgs args)
Parameters
args
MouseEventArgs
OnDoubleClick(MouseEventArgs)
Called when mouse left button double-clicked within the children node call back contains the node clicked and the point (scene coordinates)
public virtual void OnDoubleClick(MouseEventArgs args)
Parameters
args
MouseEventArgs
OnDoubleTap(TapEventArgs)
Called when double tap within the children node call back contains the node clicked and the point (scene coordinates)
public virtual void OnDoubleTap(TapEventArgs args)
Parameters
args
TapEventArgs
OnLongPress(TapEventArgs)
Called when tap and hold (long press) the children node call back contains the node clicked and the point (scene coordinates)
public virtual void OnLongPress(TapEventArgs args)
Parameters
args
TapEventArgs
OnMouseDown(MouseEventArgs)
Called when mouse left button is pressed over the children node call back contains the node clicked and the point (scene coordinates)
public virtual void OnMouseDown(MouseEventArgs args)
Parameters
args
MouseEventArgs
OnMouseEnter()
Called when mouse enter children node frame call back contains the node clicked and the point (scene coordinates) This event wont be triggered for Scene, only for children nodes
public virtual void OnMouseEnter()
OnMouseHover()
Called when mouse move over children node call back contains the node clicked and the point (scene coordinates) This event wont be triggered for Scene, only for children nodes
public virtual void OnMouseHover()
OnMouseLeave()
Called when mouse leave node call back contains the node clicked and the point (scene coordinates) This event wont be triggered for Scene, only for children nodes
public virtual void OnMouseLeave()
OnMouseUp(MouseEventArgs)
Called when mouse left button is released over the children node call back contains the node clicked and the point (scene coordinates)
public virtual void OnMouseUp(MouseEventArgs args)
Parameters
args
MouseEventArgs
OnMouseWheel(MouseEventArgs)
Called when mouse wheel is changed over the children node call back contains the node the mouse cursor is current over
public virtual void OnMouseWheel(MouseEventArgs args)
Parameters
args
MouseEventArgs
OnPan(PanEventArgs)
Called when pan move call back pan start location (scene coordinates)
public virtual void OnPan(PanEventArgs args)
Parameters
args
PanEventArgs
OnPanComplete(PanEventArgs)
Called when pan completes call back pan completes location (scene coordinates)
public virtual void OnPanComplete(PanEventArgs args)
Parameters
args
PanEventArgs
OnPanStart(PanEventArgs)
Called when pan start in a children node call back pan start location (scene coordinates)
public virtual void OnPanStart(PanEventArgs args)
Parameters
args
PanEventArgs
OnTap(TapEventArgs)
Called when tap within the children node call back contains the node clicked and the point (scene coordinates)
public virtual void OnTap(TapEventArgs args)
Parameters
args
TapEventArgs
OnTouchDownInside(TouchEventArgs)
Called when user start a touch within the Node bounds
public virtual void OnTouchDownInside(TouchEventArgs args)
Parameters
args
TouchEventArgs
OnTouchDragEnter(TouchEventArgs)
Called when touch is dragged inside back of node frame
public virtual void OnTouchDragEnter(TouchEventArgs args)
Parameters
args
TouchEventArgs
OnTouchDragExit(TouchEventArgs)
Called when touch is dragged outside of node frame
public virtual void OnTouchDragExit(TouchEventArgs args)
Parameters
args
TouchEventArgs
OnTouchDragInside(TouchEventArgs)
Called when touch is dragged within the Node frame
public virtual void OnTouchDragInside(TouchEventArgs args)
Parameters
args
TouchEventArgs
OnTouchDragOutside(TouchEventArgs)
Called when touch is dragged outside the Node frame (after it start a TouchUpInside operation)
public virtual void OnTouchDragOutside(TouchEventArgs args)
Parameters
args
TouchEventArgs
OnTouchUpInside(TouchEventArgs)
Called on touch up within the Node frame
public virtual void OnTouchUpInside(TouchEventArgs args)
Parameters
args
TouchEventArgs
OnTouchUpOutside(TouchEventArgs)
Called on touch up outside the Node frame
public virtual void OnTouchUpOutside(TouchEventArgs args)
Parameters
args
TouchEventArgs
RemoveAllAnimations()
Remove all animations from node
public void RemoveAllAnimations()
RemoveAllChildren()
Remove all children from node
public void RemoveAllChildren()
RemoveAnimationForKey(string)
Remove all animations with the given key
public void RemoveAnimationForKey(string key)
Parameters
key
stringKey used on RunAnimation
RemoveChild(Node)
Remove a single child from node
public void RemoveChild(Node child)
Parameters
child
Node
RemoveChildren(Node[])
Remove a list of children from this node
public void RemoveChildren(Node[] toRemove)
Parameters
toRemove
Node[]
RemoveFromParent()
Remove node from parent
public void RemoveFromParent()
RenderToTexture()
Render node to a Texture
public Texture RenderToTexture()
Returns
- Texture
Return a Texture object with the rendered contents of node
RunAnimation(Animation)
Adds an animation to the list of actions executed by the node.
public void RunAnimation(Animation animation)
Parameters
animation
Animationanimation to be executed
RunAnimation(Animation, Action)
Adds an animation to the list of actions executed by the node. And runs the completion handler when the animation is done
public void RunAnimation(Animation animation, Action completionHandler)
Parameters
RunAnimation(Animation, string)
Adds an animation (with a key) to the list of actions executed by the node,
public void RunAnimation(Animation animation, string key)
Parameters
RunAnimationAsync(Animation)
Create a task to add a animation to the node
public Task RunAnimationAsync(Animation animation)
Parameters
animation
AnimationReturn a Task
Returns
SendBackward()
Move node backward inside parent children
public void SendBackward()
SendToBack()
Move node to the back inside parent children
public void SendToBack()
SetScale(Vector2)
public void SetScale(Vector2 scale)
Parameters
scale
Vector2
SetScale(float)
Set X/Y scale
public void SetScale(float scale)
Parameters
scale
floatNew scale
ToString()
Display node as string
public override string ToString()
Returns
- string
String representation of node
Events
Click
Called when mouse left button clicked within the children node (called after left button down, left button up) call back contains the node clicked and the point (scene coordinates)
public event EventHandler<MouseEventArgs> Click
Event Type
DoubleClick
Called when mouse left button double-clicked within the children node call back contains the node clicked and the point (scene coordinates)
public event EventHandler<MouseEventArgs> DoubleClick
Event Type
DoubleTap
Called when node frame is double tapped call back contains the node tapped and the point (scene coordinates)
public event EventHandler<TapEventArgs> DoubleTap
Event Type
LongPress
Called when node frame is pressed and hold (long press) call back contains the node tapped and the point (scene coordinates)
public event EventHandler<TapEventArgs> LongPress
Event Type
MouseDown
Called when mouse left button is pressed over the children node call back contains the node clicked and the point (scene coordinates)
public event EventHandler<MouseEventArgs> MouseDown
Event Type
MouseEnter
Called when mouse enter children node frame call back contains the node clicked and the point (scene coordinates)
public event EventHandler MouseEnter
Event Type
MouseHover
Called when mouse move over children node call back contains the node clicked and the point (scene coordinates)
public event EventHandler MouseHover
Event Type
MouseLeave
Called when mouse leave node call back contains the children node clicked and the point (scene coordinates)
public event EventHandler MouseLeave
Event Type
MouseUp
Called when mouse left button is released over the children node call back contains the node clicked and the point (scene coordinates)
public event EventHandler<MouseEventArgs> MouseUp
Event Type
MouseWheel
Called when mouse wheel is changed over the children node call back contains the node the mouse cursor is current over
public event EventHandler<MouseEventArgs> MouseWheel
Event Type
Pan
Called when pan move happens call back contains the node pan and the point (scene coordinates)
public event EventHandler<PanEventArgs> Pan
Event Type
PanComplete
Called when pan gesture ends call back contains the node pan and the point (scene coordinates)
public event EventHandler<PanEventArgs> PanComplete
Event Type
PanStart
Called when pan gesture start over node call back contains the node pan and the point (scene coordinates)
public event EventHandler<PanEventArgs> PanStart
Event Type
Tap
Called when node frame is tapped call back contains the node tapped and the point (scene coordinates)
public event EventHandler<TapEventArgs> Tap
Event Type
TouchDownInside
Called when touch event starts within the Node frame
public event EventHandler<TouchEventArgs> TouchDownInside
Event Type
TouchDragEnter
Called when touch is dragged inside back of node frame
public event EventHandler<TouchEventArgs> TouchDragEnter
Event Type
TouchDragExit
Called when touch is dragged outside of node frame
public event EventHandler<TouchEventArgs> TouchDragExit
Event Type
TouchDragInside
Called when touch is dragged within the Node frame
public event EventHandler<TouchEventArgs> TouchDragInside
Event Type
TouchDragOutside
Called when touch is dragged outside the Node frame (after it start a TouchUpInside operation)
public event EventHandler<TouchEventArgs> TouchDragOutside
Event Type
TouchUpInside
Called on touch up within the Node frame
public event EventHandler<TouchEventArgs> TouchUpInside
Event Type
TouchUpOutside
Called on touch up outside the Node frame
public event EventHandler<TouchEventArgs> TouchUpOutside