acron.canvas2d

The 2D stage: Godot’s 2D frame (x right, y DOWN, pixels) on Acron.

Godot 2D positions are in pixels with the origin top-left-ish (y grows down). We map a Godot 2D point (x, y) to Acron world (x, 0, -y) – the XZ plane, viewed by an orthographic camera looking down +Y. Distances stay in pixels (Godot 2D “units” ARE pixels; ported constants like speed_x = 400 keep their meaning).

Draw order: Godot orders by z_index (then tree order). Depth testing/writing is OFF for the whole canvas; everything renders in Acron’s “fixed” cull bin with sort = z_index (ties resolve in scene-graph traversal order, which mirrors Godot sibling order). Use set_z_index() on any canvas node.

Viewport: Godot’s stretch/mode = "viewport" renders at the design resolution and scales to the window; the ortho film size pins the visible area to view_size pixels regardless of window size, which is the same behaviour.

Canvas2D([base, view_size, parent])

Owns the canvas root and an orthographic 2D camera.

Global Functions

g2p_2d(x: float, y: float) → LPoint3f

Godot 2D point/vector (x, y-down) -> Acron (x, 0, -y).

get_pos_2d(np) → tuple

A canvas node’s position in Godot 2D pixel coordinates (x, y-down).

p2g_2d(p) → tuple

Acron (x, y, z) on the canvas plane -> Godot 2D (x, -z).

set_pos_2d(np, x: float, y: float) → None

Place a canvas node at Godot 2D pixel coordinates.

set_z_index(np, z_index: int) → None

Godot z_index -> draw order (higher draws on top).