Class Camera

Camera for 2D scenes.

Functions

camera:init () The public constructor.
camera:set_pivot (nx, ny) Set camera pivot.
camera:get_viewport () Get viewport.
camera:move (dx, dy) Move camera.
camera:rotate (angle) Rotate camera.
camera:scale (sx, sy) Scale camera.
camera:set_position (x, y) Set camera position.
camera:get_position () Get camera position.
camera:set_bounding_box (w, h, pvx, pvy) Set camera bounding box.


Functions

camera:init ()
The public constructor.
camera:set_pivot (nx, ny)
Set camera pivot.

Parameters:

  • nx number normalized x
  • ny number normalized y
camera:get_viewport ()
Get viewport.

Returns:

  1. number x
  2. number y
  3. number w
  4. number h
camera:move (dx, dy)
Move camera.

Parameters:

  • dx number delta x
  • dy number delta y
camera:rotate (angle)
Rotate camera.

Parameters:

  • angle number in radians
camera:scale (sx, sy)
Scale camera.

Parameters:

  • sx number scale factor x
  • sy number scale factor y
camera:set_position (x, y)
Set camera position.

Parameters:

  • x number
  • y number
camera:get_position ()
Get camera position.

Returns:

  1. number self.x - self.ox
  2. number self.y - self.oy
camera:set_bounding_box (w, h, pvx, pvy)
Set camera bounding box.

Parameters:

  • w number bounding box width.
  • h number bounding box height.
  • pvx number normalized center x inside bounding box.
  • pvy number normalized center y inside bounding box.
generated by LDoc 1.4.6 Last updated 2023-03-21 17:41:24