2022-03-02 23:59:19 +01:00
|
|
|
#pragma once
|
|
|
|
|
2017-08-17 19:10:53 +02:00
|
|
|
#include <SFML/Graphics.hpp>
|
2019-01-18 01:25:29 +01:00
|
|
|
#include <cmath>
|
|
|
|
#include <filesystem>
|
|
|
|
#include <functional>
|
2021-12-31 14:59:39 +01:00
|
|
|
#include <iomanip>
|
|
|
|
#include <iostream>
|
|
|
|
#include <map>
|
2022-12-27 18:34:19 +01:00
|
|
|
#include <optional>
|
2021-12-31 14:59:39 +01:00
|
|
|
#include <sstream>
|
2022-11-18 01:48:53 +01:00
|
|
|
#include <unordered_map>
|
2017-08-17 19:10:53 +02:00
|
|
|
|
2022-04-09 00:54:06 +02:00
|
|
|
enum class Judgement {
|
|
|
|
Perfect,
|
|
|
|
Great,
|
|
|
|
Good,
|
2022-11-18 01:48:53 +01:00
|
|
|
Poor,
|
2022-04-09 00:54:06 +02:00
|
|
|
Miss
|
2017-08-17 19:10:53 +02:00
|
|
|
};
|
|
|
|
|
2022-11-18 01:48:53 +01:00
|
|
|
const static std::unordered_map<Judgement, std::string> judgement_to_name = {
|
2022-04-09 00:54:06 +02:00
|
|
|
{Judgement::Perfect, "PERFECT"},
|
|
|
|
{Judgement::Great, "GREAT"},
|
|
|
|
{Judgement::Good, "GOOD"},
|
2022-11-18 01:48:53 +01:00
|
|
|
{Judgement::Poor, "POOR"},
|
2022-04-09 00:54:06 +02:00
|
|
|
{Judgement::Miss, "MISS"}
|
|
|
|
};
|
|
|
|
|
2022-11-18 01:48:53 +01:00
|
|
|
const static std::unordered_map<std::string, Judgement> name_to_judgement = {
|
|
|
|
{"PERFECT", Judgement::Perfect},
|
|
|
|
{"GREAT", Judgement::Great},
|
|
|
|
{"GOOD", Judgement::Good},
|
|
|
|
{"POOR", Judgement::Poor},
|
|
|
|
{"MISS", Judgement::Miss}
|
|
|
|
};
|
|
|
|
|
2022-04-09 00:54:06 +02:00
|
|
|
using ref_tex = std::reference_wrapper<sf::Texture>;
|
|
|
|
using opt_ref_tex = std::optional<ref_tex>;
|
2019-01-17 15:37:15 +01:00
|
|
|
|
2019-03-27 20:37:30 +01:00
|
|
|
/*
|
2021-12-31 14:59:39 +01:00
|
|
|
* Holds the textures associated with a given marker folder from the assets
|
|
|
|
* folder
|
2019-03-27 20:37:30 +01:00
|
|
|
*/
|
2017-08-17 19:10:53 +02:00
|
|
|
class Marker {
|
|
|
|
public:
|
2022-04-09 00:54:06 +02:00
|
|
|
explicit Marker(const std::filesystem::path& folder);
|
|
|
|
opt_ref_tex at(Judgement state, sf::Time offset);
|
|
|
|
ref_tex preview(Judgement state);
|
2022-11-18 01:48:53 +01:00
|
|
|
|
|
|
|
std::filesystem::path get_folder() {return folder;};
|
2017-08-17 19:10:53 +02:00
|
|
|
private:
|
2022-04-09 00:54:06 +02:00
|
|
|
unsigned int fps = 30;
|
|
|
|
std::vector<sf::Texture> approach;
|
|
|
|
std::vector<sf::Texture> perfect;
|
|
|
|
std::vector<sf::Texture> great;
|
|
|
|
std::vector<sf::Texture> good;
|
2022-11-18 01:48:53 +01:00
|
|
|
std::vector<sf::Texture> poor;
|
2022-04-09 00:54:06 +02:00
|
|
|
std::vector<sf::Texture> miss;
|
|
|
|
|
|
|
|
std::vector<sf::Texture>& texture_vector_of(Judgement state);
|
2022-11-18 01:48:53 +01:00
|
|
|
std::filesystem::path folder;
|
2017-08-17 19:10:53 +02:00
|
|
|
};
|
|
|
|
|
2022-11-18 01:48:53 +01:00
|
|
|
Marker first_available_marker_in(const std::filesystem::path& assets_folder);
|