From 7c2d4da6e207d9bf5bfd95b504ea0d558d056842 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Fri, 26 Apr 2024 20:24:09 +0200 Subject: [PATCH] make main print available songs by default --- src/main.cpp | 50 +++++++++----------------------------------------- 1 file changed, 9 insertions(+), 41 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5f49394..e252a29 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -102,41 +102,17 @@ int main(int argc, char *argv[]) { TextureManager tman(skinDir); - Difficulty::DifficultySettings diff{ - .hpDrainRate = 3., - .circleSize = 5., - .overallDifficulty = 9., - .approachRate = 9., - }; - float deltaTime; - std::vector hitObjects; - hitObjects.push_back(HitObjectDrawable( - tman, - HitObject{ - .x = 400, - .y = 300, - .time = 2000, - .type = HitObjectType(), - .hitSound = HitSound(), - }, - diff, - 1 - )); - - hitObjects.push_back(HitObjectDrawable( - tman, - HitObject{ - .x = 500, - .y = 200, - .time = 2500, - .type = HitObjectType(), - .hitSound = HitSound(), - }, - diff, - 2 - )); + fs::path songsDir = osuPath / "Songs"; + for (const auto& songDir : fs::directory_iterator(songsDir)) { + for (const auto& beatmapDiff : fs::directory_iterator(songDir)) { + if (beatmapDiff.path().extension() == ".osu" || beatmapDiff.path().extension() == ".os") { + Difficulty diff = parseDifficulty(beatmapDiff); + std::cout << diff.metadata.artist << " - " << diff.metadata.titleUnicode << "\n"; + } + } + } while (window.isOpen()) { sf::Event event; @@ -147,17 +123,9 @@ int main(int argc, char *argv[]) { } deltaTime = clock.restart().asMilliseconds(); - - for (HitObjectDrawable &hitObject : hitObjects) { - hitObject.update(deltaTime); - } window.clear(sf::Color::Black); - for (HitObjectDrawable &hitObject : hitObjects) { - window.draw(hitObject); - } - window.display(); }