-
Notifications
You must be signed in to change notification settings - Fork 0
/
ressources.h
107 lines (93 loc) · 2.66 KB
/
ressources.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#pragma once
#ifndef RESSOURCES_H
#define RESSOURCES_H
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <string>
#include <fstream>
#include <array>
#include <vector>
#include <thread>
#include <bitset>
#include <iostream>
#include <plog/Log.h>
#include <plog/Initializers/RollingFileInitializer.h>
#include <string_view>
#include <chrono>
#include <functional>
#include <cassert>
#include <algorithm>
#include <memory>
#include <filesystem>
enum class Langue {
fr,
en,
max
};
enum class PositionJeu {
accueil,
credits,
options,
remmapage,
jeu,
chargement,
pause,
quitter_pause,
fin,
max
};
enum class TypePlateforme {
solide,
semiSolide,
objet,
checkPoint,
pics,
finTableau,
decor
};
enum Oiseau {
vole_gauche = 0,
vole_droite = 1,
marche_gauche = 2,
marche_droite = 3,
max = 4
};
enum FrameDrapeau {
inactif = -1,
frame1 = 0,
frame2 = 1
};
//class Checkpoint;
//struct Moteur;
using Clv = sf::Keyboard; //La classe sf::Keyboard (Clavier), en somme
using ensembleTouches = std::array<sf::Keyboard::Key, 7>;
//using fonctionsRessources = std::function<std::string(const int&)>;
using touchesActives = std::vector<bool>;
constexpr float vecteurNul{ 0.f };
const sf::Color couleur{ sf::Color(128, 128, 128) };
constexpr int tempsParImage{ 1000000 / 60 }; //Temps en microsecondes
namespace utilitaire {
constexpr unsigned int limiteFramerate{ 60 };
constexpr float deplacement{ 3.f };
}
bool verifTouches(const ensembleTouches& pTouches);
void resetTouches(ensembleTouches& pTouches);
//void detectionEvenement(sf::Event& evenementJeu, bool& threadsActifs, bool& peutDeplacer, touchesActives& touchesActionnees, const ensembleTouches& pTouches, sf::RenderWindow& pFenetre, std::bitset<3>& touchesNonRepetables);
std::wstring nomFichierImageTouches(const Clv::Key pTouche, const Langue langue);
std::string chargementTextures(const std::string& langue, const PositionJeu position);
float getWidth(const sf::Texture& texture);
float getWidth(const sf::Sprite& sprite);
float getHeight(const sf::Texture& texture);
float getHeight(const sf::Sprite& sprite);
//void creationLimiteCamera(Moteur& moteur);
void verifFichierExiste(const std::string& chemin);
sf::Keyboard::Key assignationTouche(const sf::Event& pEvenement, const sf::Keyboard::Key& toucheExclue, sf::Clock& cycle);
bool confirmerReiniTouches(sf::Event& pEvenement, sf::Clock& cycle);
//std::vector<std::string> splitString(std::string str, const char separator);
//template <typename T>
//T parse(const std::string& line);
inline std::vector<std::string> splitString(std::string str, const char separator);
template <typename T>
T parse(const std::string& line);
#endif