GCubeSDK
©2026 FenixFox®Studios

Object2D

base class for all 2d nodes (hud, panels, images).
All other 2D objects inherit from this class. This is the foundation class that provides:

  • Basic identification (name, id, uuid)
  • 2d transform (x, y, rotationZ, scale)
  • size and opacity
  • simple graph (parent, children)
  • local/world matrices
InheritanceDiagram node_Console Console node_Object2D Object2D node_Object2D->node_Console

Methods

Object2D()

default constructor – initializes to identity and sensible defaults

Object2D(const string& name)

constructor with custom name

name human-readable name for the object

void add(Object2D* child)

adds a child object to this node

child child node to add

void remove(Object2D* child)

removes a child from this node

child child node to remove

void removeFromParent()

detaches this node from its parent

void clear()

removes all children from this node

void translate(f32 dx, f32 dy)

translates the node in screen space

dx delta x
dy delta y

void translate(const Vector2& offset)

translates the node by vector offset

offset vector containing translation amounts

void rotate(f32 rad)

rotates the node

rad rotation in radians

void scale(f32 sx, f32 sy)

scales the node in x and y

sx scale x
sy scale y

void scale(const Vector2& scaleVec)

scales the node by vector

scaleVec vector containing scale factors

void updateMatrix()

updates local matrix from transform fields

void updateMatrixWorld(bool force)

updates world matrix, optionally forcing child updates

force propagate to children

void updateWorldMatrix(bool updateParents, bool updateChildren)

updates world matrix with optional parent/child traversal

updateParents whether to update parents first
updateChildren whether to update children after

Object2D* clone(bool recursive) const

creates a copy of this node

recursive also clone descendants

void copy(const Object2D& object, bool recursive)

copies properties from another node

object source node
recursive also copy descendants

virtual void render()

Renders this 2D object and its children

void renderText()

Renders text using console font

Properties

matrix Mtx & local pos / rot / scale matrix
matrixWorld Mtx & global pos / rot / scale matrix
isObject2D bool read
name string optional display name
id u32 unique identifier
uuid string uuid string
enabled bool active/inactive
version u32 bumps on change
position Vector2 position in 2D space
rotation f32 rotation in radians
scaleFactors Vector2 scale factors for X and Y axes
width f32 preferred width
height f32 preferred height
opacity f32 0..1
zIndex int draw order inside ui
visible bool visibility flag
color Color RGBA color for rectangle rendering
backgroundColor Color background color
backgroundImage Texture * background image texture
text string text to display
textColor Color text color (RGBA)
textSize u32 text size multiplier
textEnabled bool enable/disable text rendering
fontTexture Texture * custom font texture (nullptr = use console font)
fontCols u32 font texture columns (default 16)
fontRows u32 font texture rows (default 16)
matrixAutoUpdate bool auto
matrixWorldAutoUpdate bool auto
matrixNeedsUpdate bool flag to recalculate matrices
matrixWorldNeedsUpdate bool flag to recalculate world matrices
parent Object2D * nullptr if not existing
children vector<Object2D * > possible children
modelMatrix Mtx
worldMatrix Mtx