-
Notifications
You must be signed in to change notification settings - Fork 7
/
Menu.hpp
178 lines (143 loc) · 3.42 KB
/
Menu.hpp
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/******************************************************************************
* @file Menu.hpp
* @author Andrés Gavín Murillo, 716358
* @author Rubén Rodríguez Esteban, 737215
* @date Mayo 2020
* @coms Videojuegos - OutRun
******************************************************************************/
#ifndef OUTRUN_MENU_HPP
#define OUTRUN_MENU_HPP
#include <vector>
#include <iostream>
#include "Button.hpp"
#include "KeywordMapper.hpp"
#include "Score.hpp"
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#define SCREEN_DEFAULT_X 921
#define SCREEN_DEFAULT_Y 691
#define SCREEN_HD_X 1280
#define SCREEN_HD_Y 720
/**
* Devuelve la fuente para el tiempo.
* @return
*/
sf::Font initializeFontTimePlay();
/**
* Devuelve la fuente para la velocidad.
* @return
*/
sf::Font initializeFontSpeed();
/**
* Devuelve la fuente para las opciones.
* @return
*/
sf::Font initializeFontOptions();
const int NUM_SEGA_ICONS = 39;
const int NUM_SOUNDTRACKS = 4;
enum State {
ANIMATION,
START,
OPTIONS,
MUSIC,
GAME,
RANKING,
EXIT
};
enum Difficult {
PEACEFUL, // Without enemies
EASY,
NORMAL,
HARD
};
struct Config {
private:
const std::vector<std::pair<int, int>> resolutions;
int resIndex;
public:
/**
* Constructor por defecto.
*/
Config();
/**
* Devuelve true si se ha cambiado la resolución de pantalla.
* @return
*/
State graphicsMenu();
sf::RenderTexture w;
sf::RenderWindow window;
float screenScale;
bool isDefaultScreen;
sf::Keyboard::Key menuKey;
sf::Keyboard::Key menuUpKey;
sf::Keyboard::Key menuDownKey;
sf::Keyboard::Key menuEnterKey;
sf::Keyboard::Key accelerateKey;
sf::Keyboard::Key brakeKey;
sf::Keyboard::Key leftKey;
sf::Keyboard::Key rightKey;
sf::Font timeToPlay;
sf::Font speedVehicle;
sf::Font options;
// Vector with all the soundtracks to reproduce
std::vector<std::unique_ptr<sf::Music>> themes;
// Vector with all the sound effects to reproduce
std::vector<std::unique_ptr<sf::Music>> effects;
const float camD; // Camera depth
const int renderLen; // Length rendered
// Control the volume of the effects and the music
int volumeEffects, volumeMusic;
// Difficult level
Difficult level;
// Control if the configuration has been changed correctly
bool modifiedConfig;
// Identifier of soundtrack to reproduce
int currentSoundtrack;
// max AI aggressiveness level: max probability that the ai will be activated
float maxAggressiveness;
bool enableAI;
bool enablePixelArt;
};
/**
* Animación inicial.
* @param c
* @return
*/
State introAnimation(Config &c);
/**
* Menú de opciones.
* @param c
* @param inGame
* @return
*/
State optionsMenu(Config &c, const bool &inGame);
/**
* Menú para cambiar los controles.
* @param c
* @return
*/
State changeCarControllers(Config &c);
/**
* Animación para saleccionar la música.
* @param c
* @return
*/
State selectMusicSoundtrack(Config &c);
/**
* Menú inicial.
* @param c
* @param startPressed
* @return
*/
State startMenu(Config &c, bool startPressed = false);
/**
* Pantalla del ranking.
* @param c
* @param scorePlayerGame
* @param minutes
* @param decs
* @param cents_Second
* @return
*/
State rankingMenu(Config &c, unsigned long scorePlayerGame, int minutes, int decs, int cents_Second);
#endif //OUTRUN_MENU_HPP