#pragma once #include #include #include #include #include #include #include #include #include "better_notes.hpp" #include "better_timing.hpp" #include "special_numeric_types.hpp" namespace better { struct Chart { std::optional level; Timing timing; std::optional> hakus; Notes notes; /* Returns true if the given note (assumed to already be part of the chart) is colliding with ANOTHER note in the chart. This means notes exactly equal to the one passed as an argument are NOT taken into account. */ bool is_colliding(const better::Note& note); std::optional time_of_last_event() const; }; class PreviewLoop { public: PreviewLoop(Decimal start, Decimal duration); Decimal get_start() const; Decimal get_duration() const; private: Decimal start; Decimal duration; }; struct Metadata { std::optional title; std::optional artist; std::optional audio; std::optional jacket; std::optional> preview; }; const auto difficulty_name_comp_key = [](const std::string& s) { if (s == "BSC") { return std::make_tuple(1, std::string{}); } else if (s == "ADV") { return std::make_tuple(2, std::string{}); } else if (s == "EXT") { return std::make_tuple(3, std::string{}); } else { return std::make_tuple(4, s); } }; const auto order_by_difficulty_name = [](const std::string& a, const std::string& b) { return difficulty_name_comp_key(a) < difficulty_name_comp_key(b); }; struct Song { std::map< std::string, better::Chart, decltype(order_by_difficulty_name) > charts{order_by_difficulty_name}; Metadata metadata; Timing timing; }; }