mini_arcade_core.backend.viewport

Viewport transformation utilities.

Classes

ViewportTransform

Viewport transformation for coordinate mapping.

Module Contents

class mini_arcade_core.backend.viewport.ViewportTransform[source]

Viewport transformation for coordinate mapping.

Variables:
  • (int) (oy) – Origin x-coordinate.

  • (int) – Origin y-coordinate.

  • (float) (s) – Scaling factor.

ox: int = 0
oy: int = 0
s: float = 1.0
map_xy(x: int, y: int) tuple[int, int][source]

Map the given (x, y) coordinates using the viewport transformation.

Parameters:
  • x (int) – The x-coordinate to map.

  • y (int) – The y-coordinate to map.

Returns:

A tuple containing the mapped (x, y) coordinates.

Return type:

tuple[int, int]

map_wh(w: int, h: int) tuple[int, int][source]

Map the given width and height using the viewport transformation.

Parameters:
  • w (int) – The width to map.

  • h (int) – The height to map.

Returns:

A tuple containing the mapped (width, height).

Return type:

tuple[int, int]