Adding SoundManager to the game engine

Open the Engine.h file and add an instance of the new SoundManager class, as shown in the following highlighted code:

#pragma once 
#include <SFML/Graphics.hpp> 
#include "TextureHolder.h" 
#include "Thomas.h" 
#include "Bob.h" 
#include "LevelManager.h" 
#include "SoundManager.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; 
 
   // Create a SoundManager
   SoundManager m_SM; 
 
   const int TILE_SIZE = 50; 
   const int VERTS_IN_QUAD = 4; 

At this point, we could use m_SM to call the various play... functions. Unfortunately, there is still a bit more work to be done in order to manage ...

Get Beginning C++ Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.