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¶
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 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_identitybut 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.CanvasLayerscope (follow_viewport=False): the layer’soffset/rotation/scale_valapply in screen space, independent of the world camera. The default (identity) affine reproducespush_identityexactly, so an unconfigured layer is byte-identical to the priorpush_identitybehaviour.
- classmethod screen_space()[source]¶
Draw in screen space, bypassing the active Camera2D transform.
Pairs with the per-call
screen_space=Truekwarg ondraw_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), ...)