GlPortal Class Reference  0.1.1
Source code documentation of the free and open 3D action puzzle game.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SoundManager.hpp
Go to the documentation of this file.
1 #ifndef RADIX_SOUNDMANAGER_HPP
2 #define RADIX_SOUNDMANAGER_HPP
3 
4 #include <map>
5 #include <string>
6 
7 #include <SDL2/SDL_mixer.h>
8 
9 #include <radix/Entity.hpp>
10 
11 namespace radix {
12 
13 class SoundManager {
14 public:
15  struct SoundInfo {
16  Mix_Chunk *chunk;
17  };
18 
19  static void init();
20  static void reload();
21  static void destroy();
22 
23  static void playMusic(const std::string &filename);
24  static void playSound(const std::string &filename, const Entity &source);
25 
26  static void update(const Entity &listener);
27 
28 private:
29  static bool isInitialized, isDisabled;
30 
31  static Mix_Music *music;
32  static std::map<int, SoundInfo> sounds;
33 };
34 
35 } /* namespace radix */
36 
37 #endif /* RADIX_SOUNDMANAGER_HPP */
Definition: GameController.hpp:7
Definition: SoundManager.hpp:15
Mix_Chunk * chunk
Definition: SoundManager.hpp:16
ECS entity, Component container It is created like this:
Definition: Entity.hpp:23
static void reload()
Definition: SoundManager.cpp:147
static std::map< int, SoundInfo > sounds
Definition: SoundManager.hpp:32
static void destroy()
Definition: SoundManager.cpp:129
static void update(const Entity &listener)
Definition: SoundManager.cpp:110
Definition: SoundManager.hpp:13
static bool isInitialized
Definition: SoundManager.hpp:29
static void init()
Definition: SoundManager.cpp:13
static bool isDisabled
Definition: SoundManager.hpp:29
static void playSound(const std::string &filename, const Entity &source)
Definition: SoundManager.cpp:87
static void playMusic(const std::string &filename)
Definition: SoundManager.cpp:63
static Mix_Music * music
Definition: SoundManager.hpp:31