Skip to main content

Inverse Rotate Coordinates (screen.unrotate_xy)

Declaration

ux, uy = screen.unrotate_xy(x, y, original_rotation)

Parameters

  • x, y
    Integer. Coordinates to convert back to portrait.
  • original_rotation
    0 = coordinates are portrait (Home at bottom); returns as-is
    1 = coordinates are landscape (Home at right)
    2 = coordinates are landscape (Home at left)
    3 = coordinates are portrait (Home at top)

Returns

  • ux, uy
    Integer. Portrait coordinates corresponding to the given original_rotation coordinates.

Description

Inverse rotate coordinates, typically used to convert landscape coordinates back to portrait: init(original_rotation) -> init(0).
Requires software version 1.3.8 or later.

Example

rx, ry = screen.unrotate_xy(100, 200, 1) -- Convert landscape coordinates (100, 200) back to portrait