Class Camera
Ladybug Camera
Inheritance
System.Object
Camera
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Ladybug
Assembly: ladybug.dll
Syntax
public class Camera
Constructors
| Improve this Doc View SourceCamera(Viewport)
Creates a new Camera
Declaration
public Camera(Viewport viewport)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Graphics.Viewport | viewport |
Camera(Rectangle)
Creates a new Camera
Declaration
public Camera(Rectangle bounds)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Rectangle | bounds |
Properties
| Improve this Doc View SourceAllowedArea
World-relative bounds the Camera is restricted to
Declaration
public Rectangle AllowedArea { get; protected set; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Rectangle |
Bounds
Bounds of the Camera
Declaration
public Rectangle Bounds { get; protected set; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Rectangle |
Position
World-relative position of the Camera
Declaration
public Vector2 Position { get; protected set; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Vector2 |
TransformMatrix
Matrix representing the Camera's size, scale, and rotation
Declaration
public Matrix TransformMatrix { get; protected set; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Matrix |
View
Bounds representing what is contained within the camera's view
Declaration
public Rectangle View { get; protected set; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Rectangle |
Zoom
Zoom level
Declaration
public float Zoom { get; protected set; }
Property Value
Type | Description |
---|---|
System.Single |
Methods
| Improve this Doc View SourceClearAllowedArea()
Remove bounds restrictions
Declaration
public void ClearAllowedArea()
LerpTo(Vector2, Single)
Adjust the Camera's position via linear interpolation
Declaration
public void LerpTo(Vector2 newPosition, float by)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Vector2 | newPosition | |
System.Single | by |
Move(Vector2)
Move the Camera relative to its current position
Declaration
public void Move(Vector2 newPosition)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Vector2 | newPosition |
ScreenToWorldSpace(Vector2)
Converts a location in screen position context to a location in world position context
Declaration
public Vector2 ScreenToWorldSpace(Vector2 source)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Vector2 | source |
Returns
Type | Description |
---|---|
Microsoft.Xna.Framework.Vector2 |
SetAllowedArea(Rectangle)
Set the bounds the Camera must remain within
Declaration
public void SetAllowedArea(Rectangle r)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Rectangle | r |
SetPosition(Vector2)
Sets the Camera's position
Declaration
public void SetPosition(Vector2 newPosition)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Vector2 | newPosition |
SetZoom(Single)
Set the zoom level
Declaration
public void SetZoom(float z)
Parameters
Type | Name | Description |
---|---|---|
System.Single | z |
Update()
Updates the Camera
Declaration
public void Update()
ZoomBy(Single)
Adjust the zoom level relative to the current zoom level
Declaration
public void ZoomBy(float z)
Parameters
Type | Name | Description |
---|---|---|
System.Single | z |