Skip to content

Commit

Permalink
fixed a bug that would incorrectly load an empty marker instead of th…
Browse files Browse the repository at this point in the history
…e one selected in the menu
  • Loading branch information
Stepland committed Jan 18, 2019
1 parent 2fcd858 commit e267802
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Marker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ Marker::Marker() {
}

Marker::Marker(std::filesystem::path folder) {
if (validMarkerFolder(folder)) {
initFromFolder(folder);
return;
}
std::stringstream err;
err << "Invalid marker folder : " << folder.string();
throw std::runtime_error(err.str());
}

std::optional<std::reference_wrapper<sf::Texture>> Marker::getSprite(MarkerEndingState state, float seconds) {
Expand Down
5 changes: 3 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

int main(int argc, char** argv) {

// TODO : BPM & offset settings dans le menu Porperties
// TODO : Highlight des notes qui s'entrechoquent
// TODO : Undo / Redo
// TODO : Debug Log
Expand Down Expand Up @@ -55,14 +56,14 @@ int main(int argc, char** argv) {


// Loading markers preview
std::map<std::string,sf::Texture> markerPreviews;
std::map<std::filesystem::path,sf::Texture> markerPreviews;
for (const auto& folder : std::filesystem::directory_iterator("assets/textures/markers")) {
if (folder.is_directory()) {
try {
sf::Texture markerPreview;
markerPreview.loadFromFile((folder/"ma15.png").string());
markerPreview.setSmooth(true);
markerPreviews.insert({folder.path().filename().string(),markerPreview});
markerPreviews.insert({folder,markerPreview});
} catch (const std::exception& e) {
// ajouter e au log
}
Expand Down

0 comments on commit e267802

Please sign in to comment.