Skip to main content

Rotate Coordinates (screen.rotate_xy)

Declaration

rx, ry = screen.rotate_xy(x, y)

Parameters

  • x, y
    Integer. Original coordinates.

Returns

  • rx, ry
    Integer. Coordinates after applying the current rotation coordinate system.

Description

Convert a point from the original (unrotated) coordinate system to the rotated coordinate system that was set by screen.init.

Example

-- Suppose screen.init has set a 90-degree rotation
local rx, ry = screen.rotate_xy(100, 200)
-- Use rx, ry for operations that should follow the rotation coordinate system