Module camera

Provides a camera to limit drawing to arbitrary positions.

Functions

module:update (dt) Updates camera motion
module:worldSize (width, height) Set the world size that the camera can scroll within.
module:frame (left, top, width, height) Set the size of the frame visible through the camera.
module:lookAt (x, y) Scroll the camera to a position in it's world.
module:instant (x, y) Point the camera to a position with instant results.
module:moveBy (dx, dy) Move the camera position relative to it's current position.
module:center (x, y) Center the camera frame on a position.
module:pose () Prepare for drawing the contents of the camera world This applies transforms and clipping.
module:relax () Relax the camera when done drawing world contents.
module:pointToFrame (x, y) Convert a screen point to a point relative to the camera's frame.


Functions

module:update (dt)
Updates camera motion

Parameters:

  • dt number
module:worldSize (width, height)
Set the world size that the camera can scroll within. Camera movement is constrained within this size.

Parameters:

  • width number
  • height number
module:frame (left, top, width, height)
Set the size of the frame visible through the camera.

Parameters:

  • left number
  • top number
  • width number
  • height number
module:lookAt (x, y)
Scroll the camera to a position in it's world.

Parameters:

  • x number
  • y number
module:instant (x, y)
Point the camera to a position with instant results.

Parameters:

  • x number
  • y number
module:moveBy (dx, dy)
Move the camera position relative to it's current position.

Parameters:

  • dx number
  • dy number
module:center (x, y)
Center the camera frame on a position.

Parameters:

  • x number
  • y number
module:pose ()
Prepare for drawing the contents of the camera world This applies transforms and clipping.
module:relax ()
Relax the camera when done drawing world contents. This releases transform and clipping, restoring normal drawing state.
module:pointToFrame (x, y)
Convert a screen point to a point relative to the camera's frame.

Parameters:

  • x number
  • y number

Returns:

    number x, y or nil if the given point is outside the frame.
generated by LDoc 1.4.6 Last updated 2018-01-03 16:24:23