Table of Contents

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

float

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

float

CanBringForward

True if node can be brought forward among siblings

public bool CanBringForward { get; }

Property Value

bool

CanSendBackward

True if node can be sent backward among siblings

public bool CanSendBackward { get; }

Property Value

bool

Center

Center location of Node

public PointF Center { get; set; }

Property Value

PointF

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

Cursor

Frame

Node Frame without children

public RectangleF Frame { get; }

Property Value

RectangleF

HasAnimation

Check if not is running animations

public bool HasAnimation { get; }

Property Value

bool

HasChildren

Return whether this node has children

public bool HasChildren { get; }

Property Value

bool

HasParent

Return whether this node has children

public bool HasParent { get; }

Property Value

bool

Height

Node height

public float Height { get; }

Property Value

float

Hidden

Node visibility (when is hidden)

public bool Hidden { get; set; }

Property Value

bool

IsHitTestEnabled

Flag to control if Node can be hit-test by Mouse/Touch node events

public bool IsHitTestEnabled { get; set; }

Property Value

bool

IsMouseOver

True if the mouse cursor position is over the node

public bool IsMouseOver { get; }

Property Value

bool

IsTouchOver

True if Node is current being touch

public bool IsTouchOver { get; }

Property Value

bool

Left

Left side of Node frame (when set, will move the node position without affect the size)

public float Left { get; set; }

Property Value

float

MouseButtonPressed

Mouse button that was pressed over the node

public MouseButtons MouseButtonPressed { get; }

Property Value

MouseButtons

Name

optional name of the node

public string Name { get; set; }

Property Value

string

Parent

Parent node

public Node Parent { get; }

Property Value

Node

Paused

Pause animation of node (and children)

public bool Paused { get; set; }

Property Value

bool

PhysicsBody

PhysicsBody of node.

public PhysicsBody PhysicsBody { get; set; }

Property Value

PhysicsBody

Position

Position relative to the parent node

public PointF Position { get; set; }

Property Value

PointF

Right

Right side of Node frame (when set, will move the node position without affect the size)

public float Right { get; set; }

Property Value

float

Scale

Node scale factor

public Vector2 Scale { get; set; }

Property Value

Vector2

Scene

Get the scene the node was added

public Scene Scene { get; }

Property Value

Scene

Speed

Controls the animation speed of node (and children)

public float Speed { get; set; }

Property Value

float

Tag

User defined value to store custom information about this node.

public object Tag { get; set; }

Property Value

object

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

float

TouchCount

Total of current touches within the Node frame

public int TouchCount { get; }

Property Value

int

Width

Node width

public float Width { get; }

Property Value

float

X

X position of Node

public float X { get; set; }

Property Value

float

XScale

X scale factor

public float XScale { get; set; }

Property Value

float

Y

Y position of Node

public float Y { get; set; }

Property Value

float

YScale

Y scale factor

public float YScale { get; set; }

Property Value

float

ZPosition

Node Z offset (0-bottom, + closer to camera)

public float ZPosition { get; set; }

Property Value

float

ZRotation

Z-rotation (euler angle) using anchor as pivot

public double ZRotation { get; set; }

Property Value

double

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

RectangleF

ContainsPoint(PointF)

Check if the point is inside the node frame

public bool ContainsPoint(PointF point)

Parameters

point PointF

point 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

point PointF

point in reference parent coordinates

sourceNode Node

reference to be converted

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

point PointF

point in parent coordinates

toNode Node

Node to be used as reference

Returns

PointF

Return point converted to reference node

Copy()

Copy this node

protected virtual Node Copy()

Returns

Node

GetAnimationForKey(string)

Get the animation for the key

public Animation GetAnimationForKey(string key)

Parameters

key string

Key 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 string

name 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 PointF

point 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

bool

InParentHierarchy(Node)

Check if the node is in the hierarchy under other node

public bool InParentHierarchy(Node other)

Parameters

other Node

Returns

bool

InsertChild(int, Node)

Insert a child into the index position

public void InsertChild(int index, Node child)

Parameters

index int

Index of child

child Node

Child to be inserted

IntersectsNode(Node)

Check if one node overlaps with the other

public bool IntersectsNode(Node other)

Parameters

other Node

Other 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

x float

delta added to X position

y float

delta added to Y position

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 string

Key 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 Animation

animation 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

animation Animation

animation to be executed

completionHandler Action

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

animation Animation

animation to be executed

key string

RunAnimationAsync(Animation)

Create a task to add a animation to the node

public Task RunAnimationAsync(Animation animation)

Parameters

animation Animation

Return a Task

Returns

Task

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 float

New 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

EventHandler<MouseEventArgs>

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

EventHandler<MouseEventArgs>

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

EventHandler<TapEventArgs>

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

EventHandler<TapEventArgs>

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

EventHandler<MouseEventArgs>

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

EventHandler

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

EventHandler

MouseLeave

Called when mouse leave node call back contains the children node clicked and the point (scene coordinates)

public event EventHandler MouseLeave

Event Type

EventHandler

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

EventHandler<MouseEventArgs>

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

EventHandler<MouseEventArgs>

Pan

Called when pan move happens call back contains the node pan and the point (scene coordinates)

public event EventHandler<PanEventArgs> Pan

Event Type

EventHandler<PanEventArgs>

PanComplete

Called when pan gesture ends call back contains the node pan and the point (scene coordinates)

public event EventHandler<PanEventArgs> PanComplete

Event Type

EventHandler<PanEventArgs>

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

EventHandler<PanEventArgs>

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

EventHandler<TapEventArgs>

TouchDownInside

Called when touch event starts within the Node frame

public event EventHandler<TouchEventArgs> TouchDownInside

Event Type

EventHandler<TouchEventArgs>

TouchDragEnter

Called when touch is dragged inside back of node frame

public event EventHandler<TouchEventArgs> TouchDragEnter

Event Type

EventHandler<TouchEventArgs>

TouchDragExit

Called when touch is dragged outside of node frame

public event EventHandler<TouchEventArgs> TouchDragExit

Event Type

EventHandler<TouchEventArgs>

TouchDragInside

Called when touch is dragged within the Node frame

public event EventHandler<TouchEventArgs> TouchDragInside

Event Type

EventHandler<TouchEventArgs>

TouchDragOutside

Called when touch is dragged outside the Node frame (after it start a TouchUpInside operation)

public event EventHandler<TouchEventArgs> TouchDragOutside

Event Type

EventHandler<TouchEventArgs>

TouchUpInside

Called on touch up within the Node frame

public event EventHandler<TouchEventArgs> TouchUpInside

Event Type

EventHandler<TouchEventArgs>

TouchUpOutside

Called on touch up outside the Node frame

public event EventHandler<TouchEventArgs> TouchUpOutside

Event Type

EventHandler<TouchEventArgs>