optimitzats els constructors per defecte en Options
This commit is contained in:
@@ -37,13 +37,11 @@ namespace Options {
|
||||
|
||||
// Estructura para las opciones de las notificaciones
|
||||
struct Notification {
|
||||
bool sound; // Indica si las notificaciones suenan
|
||||
Uint8 color; // Color de las notificaciones
|
||||
bool sound{GameDefaults::NOTIFICATION_SOUND}; // Indica si las notificaciones suenan
|
||||
Uint8 color{GameDefaults::NOTIFICATION_COLOR}; // Color de las notificaciones
|
||||
|
||||
// Constructor por defecto
|
||||
Notification()
|
||||
: sound(GameDefaults::NOTIFICATION_SOUND),
|
||||
color(GameDefaults::NOTIFICATION_COLOR) {}
|
||||
Notification() = default;
|
||||
|
||||
// Constructor
|
||||
Notification(bool s, Uint8 c)
|
||||
@@ -58,17 +56,13 @@ struct Cheat {
|
||||
ENABLED = true
|
||||
};
|
||||
|
||||
State infinite_lives; // Indica si el jugador dispone de vidas infinitas
|
||||
State invincible; // Indica si el jugador puede morir
|
||||
State jail_is_open; // Indica si la Jail está abierta
|
||||
State alternate_skin; // Indica si se usa una skin diferente para el jugador
|
||||
State infinite_lives{State::DISABLED}; // Indica si el jugador dispone de vidas infinitas
|
||||
State invincible{State::DISABLED}; // Indica si el jugador puede morir
|
||||
State jail_is_open{State::DISABLED}; // Indica si la Jail está abierta
|
||||
State alternate_skin{State::DISABLED}; // Indica si se usa una skin diferente para el jugador
|
||||
|
||||
// Constructor por defecto
|
||||
Cheat()
|
||||
: infinite_lives(State::DISABLED),
|
||||
invincible(State::DISABLED),
|
||||
jail_is_open(State::DISABLED),
|
||||
alternate_skin(State::DISABLED) {}
|
||||
Cheat() = default;
|
||||
|
||||
// Constructor
|
||||
Cheat(State inf_lives, State is_invincible, State jail_enabled, State alt_skin)
|
||||
@@ -87,14 +81,12 @@ struct Cheat {
|
||||
|
||||
// Estructura para almacenar estadísticas
|
||||
struct Stats {
|
||||
int rooms; // Cantidad de habitaciones visitadas
|
||||
int items; // Cantidad de items obtenidos
|
||||
int rooms{0}; // Cantidad de habitaciones visitadas
|
||||
int items{0}; // Cantidad de items obtenidos
|
||||
std::string worst_nightmare; // Habitación con más muertes acumuladas
|
||||
|
||||
// Constructor por defecto
|
||||
Stats()
|
||||
: rooms(0),
|
||||
items(0) {}
|
||||
Stats() = default;
|
||||
|
||||
// Constructor
|
||||
Stats(int room_count, int item_count, std::string worst_nightmare_room)
|
||||
@@ -105,15 +97,12 @@ struct Stats {
|
||||
|
||||
// Estructura con opciones de la ventana
|
||||
struct Window {
|
||||
std::string caption; // Texto que aparece en la barra de título de la ventana
|
||||
int zoom; // Zoom de la ventana
|
||||
int max_zoom; // Máximo tamaño de zoom para la ventana
|
||||
std::string caption{"JailDoctor's Dilemma"}; // Texto que aparece en la barra de título de la ventana
|
||||
int zoom{GameDefaults::WINDOW_ZOOM}; // Zoom de la ventana
|
||||
int max_zoom{GameDefaults::WINDOW_ZOOM}; // Máximo tamaño de zoom para la ventana
|
||||
|
||||
// Constructor por defecto
|
||||
Window()
|
||||
: caption("JailDoctor's Dilemma"),
|
||||
zoom(GameDefaults::WINDOW_ZOOM),
|
||||
max_zoom(GameDefaults::WINDOW_ZOOM) {}
|
||||
Window() = default;
|
||||
|
||||
// Constructor
|
||||
Window(int window_zoom, int maximum_zoom)
|
||||
@@ -124,15 +113,12 @@ struct Window {
|
||||
|
||||
// Estructura para gestionar el borde de la pantalla
|
||||
struct Border {
|
||||
bool enabled; // Indica si se ha de mostrar el borde
|
||||
float width; // Ancho del borde
|
||||
float height; // Alto del borde
|
||||
bool enabled{GameDefaults::BORDER_ENABLED}; // Indica si se ha de mostrar el borde
|
||||
float width{GameDefaults::BORDER_WIDTH}; // Ancho del borde
|
||||
float height{GameDefaults::BORDER_HEIGHT}; // Alto del borde
|
||||
|
||||
// Constructor por defecto
|
||||
Border()
|
||||
: enabled(GameDefaults::BORDER_ENABLED),
|
||||
width(GameDefaults::BORDER_WIDTH),
|
||||
height(GameDefaults::BORDER_HEIGHT) {}
|
||||
Border() = default;
|
||||
|
||||
// Constructor
|
||||
Border(bool is_enabled, float border_width, float border_height)
|
||||
@@ -143,26 +129,18 @@ struct Border {
|
||||
|
||||
// Estructura para las opciones de video
|
||||
struct Video {
|
||||
bool fullscreen; // Contiene el valor del modo de pantalla completa
|
||||
ScreenFilter filter; // Filtro usado para el escalado de la imagen
|
||||
bool vertical_sync; // Indica si se quiere usar vsync o no
|
||||
bool shaders; // Indica si se van a usar shaders o no
|
||||
bool integer_scale; // Indica si el escalado de la imagen ha de ser entero en el modo a pantalla completa
|
||||
bool keep_aspect; // Indica si se ha de mantener la relación de aspecto al poner el modo a pantalla completa
|
||||
Border border; // Borde de la pantalla
|
||||
std::string palette; // Paleta de colores a usar en el juego
|
||||
std::string info; // Información sobre el modo de vídeo
|
||||
bool fullscreen{GameDefaults::VIDEO_MODE}; // Contiene el valor del modo de pantalla completa
|
||||
ScreenFilter filter{GameDefaults::VIDEO_FILTER}; // Filtro usado para el escalado de la imagen
|
||||
bool vertical_sync{GameDefaults::VIDEO_VERTICAL_SYNC}; // Indica si se quiere usar vsync o no
|
||||
bool shaders{GameDefaults::VIDEO_SHADERS}; // Indica si se van a usar shaders o no
|
||||
bool integer_scale{GameDefaults::VIDEO_INTEGER_SCALE}; // Indica si el escalado de la imagen ha de ser entero en el modo a pantalla completa
|
||||
bool keep_aspect{GameDefaults::VIDEO_KEEP_ASPECT}; // Indica si se ha de mantener la relación de aspecto al poner el modo a pantalla completa
|
||||
Border border; // Borde de la pantalla
|
||||
std::string palette{GameDefaults::PALETTE_NAME}; // Paleta de colores a usar en el juego
|
||||
std::string info; // Información sobre el modo de vídeo
|
||||
|
||||
// Constructor por defecto
|
||||
Video()
|
||||
: fullscreen(GameDefaults::VIDEO_MODE),
|
||||
filter(GameDefaults::VIDEO_FILTER),
|
||||
vertical_sync(GameDefaults::VIDEO_VERTICAL_SYNC),
|
||||
shaders(GameDefaults::VIDEO_SHADERS),
|
||||
integer_scale(GameDefaults::VIDEO_INTEGER_SCALE),
|
||||
keep_aspect(GameDefaults::VIDEO_KEEP_ASPECT),
|
||||
|
||||
palette(GameDefaults::PALETTE_NAME) {}
|
||||
Video() = default;
|
||||
|
||||
// Constructor
|
||||
Video(bool is_fullscreen, ScreenFilter screen_filter, bool vsync, bool use_shaders, bool int_scale, bool keep_aspect_ratio, Border video_border, std::string palette_name)
|
||||
@@ -178,13 +156,11 @@ struct Video {
|
||||
|
||||
// Estructura para las opciones de musica
|
||||
struct Music {
|
||||
bool enabled; // Indica si la música suena o no
|
||||
int volume; // Volumen al que suena la música (0 a 128 internamente)
|
||||
bool enabled{GameDefaults::MUSIC_ENABLED}; // Indica si la música suena o no
|
||||
int volume{VolumeHelpers::convertVolume(GameDefaults::MUSIC_VOLUME)}; // Volumen al que suena la música (0 a 128 internamente)
|
||||
|
||||
// Constructor por defecto
|
||||
Music()
|
||||
: enabled(GameDefaults::MUSIC_ENABLED),
|
||||
volume(VolumeHelpers::convertVolume(GameDefaults::MUSIC_VOLUME)) {}
|
||||
Music() = default;
|
||||
|
||||
// Constructor con parámetros
|
||||
Music(bool is_enabled, int volume_percent)
|
||||
@@ -200,13 +176,11 @@ struct Music {
|
||||
|
||||
// Estructura para las opciones de sonido
|
||||
struct Sound {
|
||||
bool enabled; // Indica si los sonidos suenan o no
|
||||
int volume; // Volumen al que suenan los sonidos (0 a 128 internamente)
|
||||
bool enabled{GameDefaults::SOUND_ENABLED}; // Indica si los sonidos suenan o no
|
||||
int volume{VolumeHelpers::convertVolume(GameDefaults::SOUND_VOLUME)}; // Volumen al que suenan los sonidos (0 a 128 internamente)
|
||||
|
||||
// Constructor por defecto
|
||||
Sound()
|
||||
: enabled(GameDefaults::SOUND_ENABLED),
|
||||
volume(VolumeHelpers::convertVolume(GameDefaults::SOUND_VOLUME)) {}
|
||||
Sound() = default;
|
||||
|
||||
// Constructor con parámetros
|
||||
Sound(bool is_enabled, int volume_percent)
|
||||
@@ -222,15 +196,13 @@ struct Sound {
|
||||
|
||||
// Estructura para las opciones de audio
|
||||
struct Audio {
|
||||
Music music; // Opciones para la música
|
||||
Sound sound; // Opciones para los efectos de sonido
|
||||
bool enabled; // Indica si el audio está activo o no
|
||||
int volume; // Volumen al que suenan el audio (0-128 internamente)
|
||||
Music music; // Opciones para la música
|
||||
Sound sound; // Opciones para los efectos de sonido
|
||||
bool enabled{GameDefaults::AUDIO_ENABLED}; // Indica si el audio está activo o no
|
||||
int volume{VolumeHelpers::convertVolume(GameDefaults::AUDIO_VOLUME)}; // Volumen al que suenan el audio (0-128 internamente)
|
||||
|
||||
// Constructor por defecto
|
||||
Audio()
|
||||
: enabled(GameDefaults::AUDIO_ENABLED),
|
||||
volume(VolumeHelpers::convertVolume(GameDefaults::AUDIO_VOLUME)) {}
|
||||
Audio() = default;
|
||||
|
||||
// Constructor
|
||||
Audio(Music audio_music, Sound audio_sound, bool is_enabled, int volume_percent)
|
||||
@@ -242,13 +214,11 @@ struct Audio {
|
||||
|
||||
// Estructura para las opciones de juego
|
||||
struct Game {
|
||||
float width; // Ancho de la resolucion del juego
|
||||
float height; // Alto de la resolucion del juego
|
||||
float width{GameDefaults::GAME_WIDTH}; // Ancho de la resolucion del juego
|
||||
float height{GameDefaults::GAME_HEIGHT}; // Alto de la resolucion del juego
|
||||
|
||||
// Constructor por defecto
|
||||
Game()
|
||||
: width(GameDefaults::GAME_WIDTH),
|
||||
height(GameDefaults::GAME_HEIGHT) {}
|
||||
Game() = default;
|
||||
|
||||
// Constructor
|
||||
Game(float game_width, float game_height)
|
||||
|
||||
Reference in New Issue
Block a user