Node2D

A 2D game object, with a transform (position, rotation, and scale).

Members

Functions

draw
void draw(Canvas* canvas)

Override this to draw something. The canvas should be transformed by this node's position, scale, and rotation.

position
vec2f position()
Undocumented in source. Be warned that the author may not have intended to support it.
position
void position(vec2f pos)
Undocumented in source. Be warned that the author may not have intended to support it.
rotation
float rotation()

Get rotation in radians, relative to the node's parent.

rotation
void rotation(float angle)

Set rotation in radians, relative to the node's parent.

scale
vec2f scale()

Sets the node's scale.

scale
void scale(vec2f s)
Undocumented in source. Be warned that the author may not have intended to support it.
translate
void translate(vec2f offset)

Translates the node by the given offset in local coordinates.

Inherited Members

From Node

~this
~this()
Undocumented in source.
getParent
Node getParent()

Returns the parent node of the current node, or null if the node lacks a parent.

addChild
Node addChild(Node node)

Add child. Return parent for chaining.

removeChild
void removeChild(Node node)

Removes a child node. The node is NOT deleted and must be deleted manually.

update
void update(double deltaTime)
Undocumented in source. Be warned that the author may not have intended to support it.
getChildren
Node[] getChildren()
Undocumented in source. Be warned that the author may not have intended to support it.
drawOnCanvas
void drawOnCanvas(Canvas* canvas)

Draw Node and its children on this canvas. This call their draw() methods recursively, using each Node2D transform. Usually you would take the one returned by the Game.canvas() call.

doUpdate
void doUpdate(double deltaTime)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta