The pixel/meter ratio of the camera. It is computed from the zoom and the size of the screen, so it works with resizing.
How far the camera is zoomed. 1 is the starting view, 2 is twice as close, and 0.5 is twice as far.
Set how far the camera is zoomed (1 is the starting view), and redraw
Return the Y coordinate of the bottom of the camera viewport
Return the X coordinate of the left of the camera viewport
Return the X coordinate of the right of the camera viewport
Return the Y coordinate of the top of the camera viewport
Convert world coordinates (meters) to screen coordinates (absolute pixels)
The X coordinate, in meters
The Y coordinate, in meters
The X coordinate, in pixels
The Y coordinate, in pixels
Convert screen coordinates (absolute pixels), to world coordinates (meters)
The X coordinate, in pixels
The Y coordinate, in pixels
The X coordinate, in meters
The Y coordinate, in meters
Update a camera's bounds by providing a new maximum (X, Y) coordinate
OptionalmaxX?: numberThe new maximum X value (in meters)
OptionalmaxY?: numberThe new maximum Y value (in meters)
OptionalminX?: numberThe new minimum X value (in meters)
OptionalminY?: numberThe new minimum Y value (in meters)
Make the camera follow an Actor. Optionally add an offset to the actor's center, and center the camera on that point instead. Optionally give a lag, so that the camera eases toward that point instead of staying exactly on it.
The actor to follow
Amount of x distance to add to actor center
Amount of y distance to add to actor center
How many seconds the camera takes to close most of the distance to the point it is following. The default, 0, keeps the camera exactly on that point.
Set the center point on which the camera should focus. If the requested center would push the camera's viewport past the camera's bounds, the center is shifted inward just enough to keep the viewport within bounds, rather than showing empty space past the edge of the world.
NB: This is called (indirectly) by the render loop in order to make sure we don't go out of bounds.
The X coordinate of the center point (in meters)
The Y coordinate of the center point (in meters)
Shake the camera, so that a hit or an explosion can be felt. The shake starts at the given size and dies down to nothing. It is applied on top of wherever the camera is, so it works whether or not the camera is following an Actor. A second shake replaces the first, unless it would be weaker.
How long the shake lasts
How far, in meters, the camera is thrown at the start
The Camera is used to determine /how much/ of a world to render, and /which part/. The Camera can have a minimum X and Y coordinate, and a maximum X and Y coordinate. It also has a zoom factor, and a current center point.
The zoom factor and center point give a rectangular region. The min and max coordinates give another rectangular region. If the first region is not fully within the second, we shift it so that it is within, and then we only show those things that are within it.
Note that the camera center can be changed dynamically, in response to changes in the world to which the camera is attached.