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:
- number x
- number y
- number w
- 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:
- number self.x - self.ox
- 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.