diff --git a/src/custom_sfml_audio/fake_pitched_sound_stream.cpp b/src/custom_sfml_audio/fake_pitched_sound_stream.cpp index 484335c..0244f91 100644 --- a/src/custom_sfml_audio/fake_pitched_sound_stream.cpp +++ b/src/custom_sfml_audio/fake_pitched_sound_stream.cpp @@ -5,6 +5,8 @@ #include #include +#include "utf8_strings.hpp" + FakePitchedSoundStream::FakePitchedSoundStream( const std::filesystem::path& path_to_sample, float pitch_ @@ -12,7 +14,7 @@ FakePitchedSoundStream::FakePitchedSoundStream( pitch(pitch_), sample(std::make_shared()) { - if (not sample->loadFromFile(path_to_sample)) { + if (not sample->loadFromFile(to_utf8_encoded_string(path_to_sample))) { throw std::runtime_error(fmt::format("Could not load audio sample : {}", path_to_sample.string())); } finish_initializing_the_sample(); diff --git a/src/editor_state.cpp b/src/editor_state.cpp index 2a58a5e..924fc36 100644 --- a/src/editor_state.cpp +++ b/src/editor_state.cpp @@ -40,6 +40,7 @@ #include "src/better_timing.hpp" #include "src/custom_sfml_audio/synced_sound_streams.hpp" #include "variant_visitor.hpp" +#include "utf8_strings.hpp" EditorState::EditorState(const std::filesystem::path& assets_, config::Config& config_) : config(config_), @@ -1396,7 +1397,7 @@ void EditorState::reload_jacket() { if ( not std::filesystem::exists(jacket_path) - or not jacket->loadFromFile(jacket_path.string()) + or not jacket->loadFromFile(to_utf8_encoded_string(jacket_path)) ) { jacket.reset(); } else { diff --git a/src/ln_marker.hpp b/src/ln_marker.hpp index 22ffef1..3b527a2 100644 --- a/src/ln_marker.hpp +++ b/src/ln_marker.hpp @@ -13,6 +13,8 @@ #include #include +#include "utf8_strings.hpp" + using opt_tex_ref = std::optional>; /* @@ -65,7 +67,7 @@ std::array load_tex_with_prefix( ); std::filesystem::path texFile = folder / filename; sf::Texture tex; - if (!tex.loadFromFile(texFile.string())) { + if (!tex.loadFromFile(to_utf8_encoded_string(texFile))) { throw std::runtime_error(fmt::format( "Unable to load texture folder {}, failed on texture {}", folder.string(), diff --git a/src/main.cpp b/src/main.cpp index 73c2b91..c2c396d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -77,7 +77,7 @@ int main() { std::filesystem::directory_iterator(assets_folder / "textures" / "markers")) { if (folder.is_directory()) { sf::Texture markerPreview; - markerPreview.loadFromFile((folder.path() / "ma15.png").string()); + markerPreview.loadFromFile(to_utf8_encoded_string(folder.path() / "ma15.png")); markerPreview.setSmooth(true); markerPreviews.insert({folder, markerPreview}); } diff --git a/src/marker.cpp b/src/marker.cpp index 1ca612a..68bf393 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -4,6 +4,8 @@ #include #include +#include "utf8_strings.hpp" + Marker first_available_marker_in(const std::filesystem::path& assets_folder) { for (auto& folder : std::filesystem::directory_iterator(assets_folder / "textures" / "markers")) { try { @@ -20,7 +22,7 @@ Marker::Marker(const std::filesystem::path& folder_): const auto emplace_back = [&](std::vector& vec, const std::string& file){ auto& tex = vec.emplace_back(); const auto path = folder / file; - if (not tex.loadFromFile(path.string())) { + if (not tex.loadFromFile(to_utf8_encoded_string(path))) { throw std::runtime_error(fmt::format( "Unable to load marker {} - failed on image {}", folder.string(), diff --git a/src/playfield.cpp b/src/playfield.cpp index 9b83cf3..efdebe2 100644 --- a/src/playfield.cpp +++ b/src/playfield.cpp @@ -1,6 +1,7 @@ #include "playfield.hpp" #include "toolbox.hpp" +#include "utf8_strings.hpp" const std::string texture_file = "textures/edit_textures/game_front_edit_tex_1.tex.png"; @@ -8,7 +9,7 @@ Playfield::Playfield(std::filesystem::path assets_folder) : long_note(assets_folder / "textures" / "long"), texture_path(assets_folder / texture_file) { - if (!base_texture.loadFromFile(texture_path)) { + if (!base_texture.loadFromFile(to_utf8_encoded_string(texture_path))) { std::cerr << "Unable to load texture " << texture_path; throw std::runtime_error("Unable to load texture " + texture_path.string()); } diff --git a/src/sound_effect.cpp b/src/sound_effect.cpp index 3f593c4..ec21fff 100644 --- a/src/sound_effect.cpp +++ b/src/sound_effect.cpp @@ -3,12 +3,13 @@ #include #include "toolbox.hpp" +#include "utf8_strings.hpp" SoundEffect::SoundEffect(std::filesystem::path path) : shouldPlay(false), buffer(), volume(10) { - if (!buffer.loadFromFile(path.string())) { + if (!buffer.loadFromFile(to_utf8_encoded_string(path))) { throw std::runtime_error("Unable to load sound : " + path.string()); } diff --git a/src/widgets/blank_screen.cpp b/src/widgets/blank_screen.cpp index 604d018..a897253 100644 --- a/src/widgets/blank_screen.cpp +++ b/src/widgets/blank_screen.cpp @@ -2,8 +2,10 @@ #include +#include "utf8_strings.hpp" + BlankScreen::BlankScreen(std::filesystem::path assets) : gris_de_fond(sf::Color(38, 38, 38)) { - if (!tex_FEIS_logo.loadFromFile(assets / "textures" / "FEIS_logo.png")) { + if (!tex_FEIS_logo.loadFromFile(to_utf8_encoded_string(assets / "textures" / "FEIS_logo.png"))) { throw std::string("Unable to load assets/textures/FEIS_logo.png"); } tex_FEIS_logo.setSmooth(true); diff --git a/src/widgets/density_graph.cpp b/src/widgets/density_graph.cpp index fba22ef..29edf0e 100644 --- a/src/widgets/density_graph.cpp +++ b/src/widgets/density_graph.cpp @@ -2,13 +2,15 @@ #include +#include "utf8_strings.hpp" + const std::string texture_file = "textures/edit_textures/game_front_edit_tex_1.tex.png"; DensityGraph::DensityGraph(std::filesystem::path assets, const config::Config& config) : texture_path(assets / texture_file), collision_zone(config.editor.collision_zone) { - if (!base_texture.loadFromFile(texture_path)) { + if (!base_texture.loadFromFile(to_utf8_encoded_string(texture_path))) { std::cerr << "Unable to load texture " << texture_path; throw std::runtime_error("Unable to load texture " + texture_path.string()); }