Adding camera instances to the game
We will have two cameras, one for the main view of the game and one for our mini map.
Open the Factory.cpp
file. Add the following two highlighted include
directives to the top of the file.
#include "Factory.h"
#include "LevelUpdate.h"
#include "PlayerGraphics.h"
#include "PlayerUpdate.h"
#include "InputDispatcher.h"
#include "CameraUpdate.h"
#include "CameraGraphics.h"
Now add the following code for the first camera. Add all the camera code after the code that handles the player, at the very end (but inside) of the loadLevel
function. Note that the first couple of lines are for both cameras; we will get to the second camera next. The regular full-screen camera is added first; otherwise, it would hide the mini-map camera.
// For both the cameras
const float width = float(VideoMode::getDesktopMode().width);
const float height = float(VideoMode::getDesktopMode(...