about summary refs log tree commit diff stats
path: root/data/maps/the_stormy/rooms/Volcano Side.txtpb
blob: 73c7ae42f42a3c5c3974114be9e13fd14e0d097c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
name: "Volcano Side"
panels {
  name: "SNOW"
  path: "Panels/Room_1/panel_1"
  clue: "snow"
  answer: "blizzard"
  symbols: PYRAMID
}
panels {
  name: "RAIN"
  path: "Panels/Room_1/panel_3"
  clue: "rain"
  answer: "hail"
  symbols: CROSS
}
#include <stdexcept> #include <map> #include <string> class mix_error : public std::logic_error { public: mix_error() : std::logic_error(Mix_GetError()) { } }; class mix_wrapper { public: mix_wrapper() { if (Mix_Init(0) != 0) { mix_error ex; Mix_Quit(); throw ex; } if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, 1024) != 0) { mix_error ex; Mix_Quit(); throw ex; } } ~mix_wrapper() { Mix_CloseAudio(); Mix_Quit(); } }; class chunk_deleter { public: void operator()(Mix_Chunk* chunk) { Mix_FreeChunk(chunk); } }; using chunk_ptr = std::unique_ptr<Mix_Chunk, chunk_deleter>; // MUST create the Renderer first! class Mixer { public: void playSound(std::string_view filename); int loopSound(std::string_view filename); void stopChannel(int channel); private: Mix_Chunk* getChunkByFilename(std::string filename); mix_wrapper mix_; std::map<std::string, chunk_ptr> sounds_; }; #endif /* end of include guard: MIXER_H_6DF82000 */