Coding the camera classes
We will have two cameras in our game, and each will have an Update
derived class and a Graphics
derived class. The CameraUpdate
class will handle movement to follow the player and interaction with the operating system via an InputReceiver
instance. The CameraGraphics
class will handle all the drawing by referring to the data in CameraUpdate
and holding a copy of the texture atlas, the RenderWindow instance, and an SFML Text
object. Later, in Chapter 21, we will introduce a couple more features (and draw
calls) to add a parallax background and a neat shader effect.
Coding the CameraUpdate class
Create two new classes to represent the cameras: CameraUpdate
, which has a base class of Update
, and CameraGraphics
, which has a base class of Graphics
. As we are coming to expect, these classes will be wrapped/composed in a GameObject
instance for use in our game loop.
Add the following code to the CameraUpdate.h
file:
#pragma once
#include "Update...