The purpose of the camera is to create a transformation matrix that changes the way a sprite batch is rendered.
To create a camera initialize an instance of it using one of the constructor overloads. It's recommended that you used a viewport adapter to scale the screen but you don't have to.
Next you'll need to apply the camera's view matrix to one or more of the
SpriteBatch.Begin calls in your
TransformationMatrix is one of the parameters of a
The transformation matrix is used for scale, rotate, and translate options. In other words, we use the camera to transform the way a batch of sprites is rendered to the screen without actually modifying their positions, rotations, or scales directly. This creates the effect of having a camera looking at your scene that can move, rotate, and zoom in and out.
Once you've got a camera instance in your game you'll probably want to move it around in the
Update method somehow. For example, you could move the camera's position with the arrow keys.
Last but not least, there'll be times when you want to convert from screen coordinates to world coordinates and visa-vera. For example, if you want to know which sprite is under the mouse you'll need to convert the mouse position back into the world position that was used to position the sprite in the first place.