Using the HUD class
Open Engine.h
, add an include for our new class, declare an instance of the new HUD
class, and declare and initialize two new member variables that will keep track of how often we update the HUD. As we learned in the previous projects, we don't need to update the HUD every frame.
Add the following highlighted code to Engine.h
:
#pragma once #include <SFML/Graphics.hpp> #include "TextureHolder.h" #include "Thomas.h" #include "Bob.h" #include "LevelManager.h" #include "SoundManager.h" #include "HUD.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 m_LM; ...