|
|
@ -8,7 +8,6 @@ |
|
|
|
#include <SFML/Audio.hpp> |
|
|
|
#include <SFML/Audio.hpp> |
|
|
|
#include <nlohmann/json.hpp> |
|
|
|
#include <nlohmann/json.hpp> |
|
|
|
#include <fstream> |
|
|
|
#include <fstream> |
|
|
|
#include "sfmlbackend.hpp" |
|
|
|
|
|
|
|
#include "builder.hpp" |
|
|
|
#include "builder.hpp" |
|
|
|
|
|
|
|
|
|
|
|
using std::string, std::vector; |
|
|
|
using std::string, std::vector; |
|
|
@ -17,25 +16,6 @@ using namespace fmt; |
|
|
|
using namespace nlohmann; |
|
|
|
using namespace nlohmann; |
|
|
|
namespace fs = std::filesystem; |
|
|
|
namespace fs = std::filesystem; |
|
|
|
|
|
|
|
|
|
|
|
void SoundQuip::load(json &data, const char *file_key) { |
|
|
|
|
|
|
|
auto audio = data["audio"]; |
|
|
|
|
|
|
|
json::string_t file_name = audio[file_key].template get<string>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!buffer.loadFromFile(file_name)) { |
|
|
|
|
|
|
|
println("Failed to load sound: {} with file {}", file_key, file_name); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sound.setBuffer(buffer); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SoundQuip::play() { |
|
|
|
|
|
|
|
sound.play(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SoundQuip::stop() { |
|
|
|
|
|
|
|
sound.stop(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GUI::GUI() { |
|
|
|
GUI::GUI() { |
|
|
|
std::ifstream infile(".tarpit.json"); |
|
|
|
std::ifstream infile(".tarpit.json"); |
|
|
|
json data = json::parse(infile); |
|
|
|
json data = json::parse(infile); |
|
|
|