F.E.I.S/Marker.h

66 lines
1.5 KiB
C
Raw Normal View History

2017-08-17 19:10:53 +02:00
//
// Created by Syméon on 17/08/2017.
//
2017-08-17 23:41:11 +02:00
//
// Un objet marker contient les différentes textures d'un marker choisi
//
2017-08-17 19:10:53 +02:00
#ifndef FEIS_MARKER_H
#define FEIS_MARKER_H
#include <iostream>
#include <SFML/Graphics.hpp>
#include <map>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <filesystem>
#include <functional>
2017-08-17 19:10:53 +02:00
2019-01-14 21:43:56 +01:00
enum MarkerEndingState {
MarkerEndingState_MISS,
MarkerEndingState_EARLY,
MarkerEndingState_GOOD,
MarkerEndingState_GREAT,
MarkerEndingState_PERFECT
2017-08-17 19:10:53 +02:00
};
struct MarkerStatePreview {
MarkerEndingState state;
std::string textureName;
std::string printName;
};
namespace Markers {
static std::vector<MarkerStatePreview> markerStatePreviews{
{MarkerEndingState_PERFECT,"h402","PERFECT"},
{MarkerEndingState_GREAT,"h302","GREAT"},
{MarkerEndingState_GOOD,"h202","GOOD"},
{MarkerEndingState_EARLY,"h102","EARLY / LATE"},
{MarkerEndingState_MISS,"ma17","MISS"}
};
}
/*
* Holds the textures associated with a given marker folder from the assets folder
*/
2017-08-17 19:10:53 +02:00
class Marker {
public:
Marker();
explicit Marker(std::filesystem::path folder);
2019-01-17 03:02:37 +01:00
std::optional<std::reference_wrapper<sf::Texture>> getSprite(MarkerEndingState state, float seconds);
const std::map<std::string, sf::Texture> &getTextures() const;
2017-08-17 19:10:53 +02:00
private:
std::map<std::string,sf::Texture> textures;
std::filesystem::path path;
bool validMarkerFolder(std::filesystem::path folder);
void initFromFolder(std::filesystem::path folder);
2017-08-17 19:10:53 +02:00
};
#endif //FEIS_MARKER_H