simvx.core.nodes_2d.ninepatch¶
PatchRect and NinePatchRect – 9-slice scalable bordered texture.
Module Contents¶
Classes¶
A rectangle defined by position and size. |
|
9-slice scalable bordered texture for UI panels, speech bubbles, and HUD elements. |
API¶
- class simvx.core.nodes_2d.ninepatch.PatchRect[source]¶
Bases:
typing.NamedTupleA rectangle defined by position and size.
- x: float¶
None
- y: float¶
None
- w: float¶
None
- h: float¶
None
- class simvx.core.nodes_2d.ninepatch.NinePatchRect(**kwargs: Any)[source]¶
Bases:
simvx.core.nodes_2d.node2d.Node2D9-slice scalable bordered texture for UI panels, speech bubbles, and HUD elements.
Divides a source texture into 9 regions using margin values. Corners stay fixed-size, edges stretch along one axis, and the centre fills the remainder.
Initialization
- texture¶
‘Property(…)’
- texture_size¶
‘Property(…)’
- size¶
‘Property(…)’
- patch_margin_left¶
‘Property(…)’
- patch_margin_top¶
‘Property(…)’
- patch_margin_right¶
‘Property(…)’
- patch_margin_bottom¶
‘Property(…)’
- draw_center¶
‘Property(…)’
- axis_stretch_horizontal¶
‘Property(…)’
- axis_stretch_vertical¶
‘Property(…)’
- modulate¶
‘Property(…)’
- get_rect() simvx.core.nodes_2d.ninepatch.PatchRect[source]¶
Bounding rectangle at global position with current display size.
- get_nine_patch_rects() list[tuple[simvx.core.nodes_2d.ninepatch.PatchRect, simvx.core.nodes_2d.ninepatch.PatchRect]][source]¶
Compute (source_uv_rect, dest_position_rect) pairs for the 9 patches.
Returns up to 9 pairs (8 if draw_center is False). Patches with zero width or height are omitted.
- z_index¶
‘Property(…)’
- z_as_relative¶
‘Property(…)’
- render_layer¶
‘Property(…)’
- set_render_layer(index: int, enabled: bool = True) None¶
- is_on_render_layer(index: int) bool¶
- property absolute_z_index: int¶
- property position: simvx.core.math.types.Vec2¶
- property rotation: float¶
- property rotation_degrees: float¶
- property scale: simvx.core.math.types.Vec2¶
- property world_position: simvx.core.math.types.Vec2¶
- property world_rotation: float¶
- property world_scale: simvx.core.math.types.Vec2¶
- property forward: simvx.core.math.types.Vec2¶
- property right: simvx.core.math.types.Vec2¶
- translate(offset: tuple[float, float] | numpy.ndarray)¶
- rotate(radians: float)¶
- rotate_deg(degrees: float)¶
- look_at(target: tuple[float, float] | numpy.ndarray)¶
- transform_points(points: list[simvx.core.math.types.Vec2]) list[simvx.core.math.types.Vec2]¶
- draw_polygon(renderer, points: list[simvx.core.math.types.Vec2], closed=True, colour=None)¶
- wrap_screen(margin: float = 20)¶
- strict_errors: ClassVar[bool]¶
True
- script_error_raised¶
‘Signal(…)’
- classmethod __init_subclass__(**kwargs)¶
- property name: str¶
- property process_mode: simvx.core.descriptors.ProcessMode¶
- reset_error() None¶
- add_child(node: simvx.core.node.Node) simvx.core.node.Node¶
- remove_child(node: simvx.core.node.Node)¶
- reparent(new_parent: simvx.core.node.Node)¶
- get_node(path: str) simvx.core.node.Node¶
- find_child(name: str, recursive: bool = False) simvx.core.node.Node | None¶
- find(node_type: type, recursive: bool = True) simvx.core.node.Node | None¶
- property path: str¶
- add_to_group(group: str)¶
- remove_from_group(group: str)¶
- is_in_group(group: str) bool¶
- ready() None¶
- enter_tree() None¶
- exit_tree() None¶
- process(dt: float) None¶
- physics_process(dt: float) None¶
- input_event(event: simvx.core.events.InputEvent) None¶
- input(event: simvx.core.events.TreeInputEvent) None¶
- unhandled_input(event: simvx.core.events.TreeInputEvent) None¶
- start_coroutine(gen: simvx.core.descriptors.Coroutine) simvx.core.descriptors.CoroutineHandle¶
- stop_coroutine(gen_or_handle)¶
- clear_children()¶
- destroy()¶
- property app¶
- property tree: simvx.core.scene_tree.SceneTree¶
- get_tree() simvx.core.scene_tree.SceneTree¶
- __getitem__(key: str)¶
- classmethod get_properties() dict[str, simvx.core.descriptors.Property]¶
- __repr__()¶