Coding the loadLevel function
To be clear, this function is part of the Engine
class, although it will delegate much of its work to other functions, including those of the LevelManager
class that we just built.
First, let's add the declaration for the new function, along with some other new pieces of code, to the Engine.h
file. Open the Engine.h
file and add the highlighted lines of code shown in the abbreviated snapshot of the Engine.h
file, as follows:
#pragma once #include <SFML/Graphics.hpp> #include "TextureHolder.h" #include "Thomas.h" #include "Bob.h" #include "LevelManager.h" using namespace sf; class Engine { private: // The texture holder TextureHolder th; // Thomas and his friend, Bob Thomas m_Thomas; Bob m_Bob; // A class to manage all the levels LevelManager...