simvx.graphics.draw2d_transform

2D affine transform stack for Draw2D.

Provides push/pop transform composition used by all drawing primitives to support rotated, scaled, and translated coordinate spaces, plus a screen_space() context manager that temporarily disables the active camera transform for HUDs and overlays.

Module Contents

Classes

Draw2DTransformMixin

Mixin providing a 2D affine transform stack for Draw2D.

API

class simvx.graphics.draw2d_transform.Draw2DTransformMixin[source]

Mixin providing a 2D affine transform stack for Draw2D.

classmethod push_transform(a, b, c, d, tx, ty)[source]

Push a 2D affine transform, composing with current.

classmethod pop_transform()[source]

Pop the last transform, restoring the previous one.

classmethod push_identity()[source]

Push current transform and reset to identity (for screen-space drawing).

classmethod push_screen_transform(a, b, c, d, tx, ty)[source]

Push current transform and SET (not compose) the given affine.

Like :meth:push_identity but to an arbitrary affine instead of identity: the active Camera2D is bypassed and replaced by (a, b, c, d, tx, ty). This is the screen-pinned :class:~simvx.core.nodes_2d.canvas.CanvasLayer scope (follow_viewport=False): the layer’s offset/rotation/scale_val apply in screen space, independent of the world camera. The default (identity) affine reproduces push_identity exactly, so an unconfigured layer is byte-identical to the prior push_identity behaviour.

classmethod screen_space()[source]

Draw in screen space, bypassing the active Camera2D transform.

Pairs with the per-call screen_space=True kwarg on draw_rect / draw_circle / draw_line: use the context manager when several HUD calls share the same scope, the kwarg for a single overlay primitive.

with renderer.screen_space():
    renderer.draw_rect((10, 10), (100, 20), filled=True, ...)
    renderer.draw_text("HP", (12, 12), ...)