Updated the SFML support stuff to use the Config that can be oriented at a BASE_DIR to find stuff relative to the config file.

This commit is contained in:
Zed A. Shaw 2025-05-13 02:02:47 -04:00
parent 4d71f552aa
commit de0d957c66
6 changed files with 28 additions and 8 deletions

View file

@ -2,8 +2,10 @@
#include <nlohmann/json.hpp>
#include <fstream>
#include <codecvt>
#include <filesystem>
struct Config {
static std::filesystem::path BASE_DIR;
nlohmann::json $config;
std::string $src_path;
@ -16,4 +18,7 @@ struct Config {
nlohmann::json &json() { return $config; };
std::wstring wstring(const std::string main_key, const std::string sub_key);
std::vector<std::string> keys();
static void set_base_dir(const char *optarg);
static std::filesystem::path path_to(const std::string& path);
};

View file

@ -16,7 +16,7 @@ namespace sound {
};
void init();
void load(const std::string& name, const std::string& path);
void load(const std::string& name, const std::filesystem::path& path);
void play(const std::string& name, bool loop=false);
void play_at(const std::string& name, float x, float y, float z);
void stop(const std::string& name);