Working sound system and most enemies have a sound effect. This will make it easier to add sounds now.

This commit is contained in:
Zed A. Shaw 2025-02-22 12:48:37 -05:00
parent 83df9ff03b
commit 20cbc3a21c
12 changed files with 126 additions and 5 deletions

22
sound.hpp Normal file
View file

@ -0,0 +1,22 @@
#pragma once
#include <string>
#include <filesystem>
#include <memory>
#include <unordered_map>
#include <SFML/Audio.hpp>
namespace sound {
struct SoundPair {
std::shared_ptr<sf::SoundBuffer> buffer;
std::shared_ptr<sf::Sound> sound;
};
struct SoundManager {
std::unordered_map<std::string, SoundPair> sounds;
};
void init();
void load(const std::string name, const std::string path);
void play(const std::string name);
void play_at(const std::string name, float x, float y, float z);
}