Coding the LevelManager class
The LevelManager
class is the connection between what we coded in Chapter 19, Game Programming Design Patterns – Starting the Space Invaders ++ Game, and everything we coded in this chapter. The ScreenManager
class will have an instance of the LevelManager
class, and the LevelManager
class will instigate loading levels (using all the classes we have just coded) and share GameObject
instances with any classes that need them.
Create a new header file in the Header Files/Engine
filter called LevelManager.h
and add the following code:
#pragma once #include "GameObject.h" #include <vector> #include <string> #include "GameObjectSharer.h" using namespace std; class LevelManager : public GameObjectSharer { private: Â Â Â Â vector<GameObject> m_GameObjects; Â Â Â Â const std::string WORLD_FOLDER = "world"; Â Â Â Â const std::string SLASH = "/"...