options.h ara gasta defaults.h
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL3/SDL.h> // Para SDL_ScaleMode
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "color.h"
|
||||
@@ -200,4 +202,35 @@ constexpr const char* PLAYER0 = "66323FFF";
|
||||
constexpr const char* PLAYER1 = "422028FF";
|
||||
} // namespace OutlineColor
|
||||
} // namespace Player
|
||||
|
||||
// --- OPTIONS ---
|
||||
namespace Options {
|
||||
// Window
|
||||
constexpr const char* WINDOW_CAPTION = "Coffee Crisis Arcade Edition";
|
||||
constexpr int WINDOW_ZOOM = 2;
|
||||
constexpr int WINDOW_MAX_ZOOM = 2;
|
||||
|
||||
// Video
|
||||
constexpr SDL_ScaleMode VIDEO_SCALE_MODE = SDL_ScaleMode::SDL_SCALEMODE_NEAREST;
|
||||
constexpr bool VIDEO_FULLSCREEN = false;
|
||||
constexpr bool VIDEO_VSYNC = true;
|
||||
constexpr bool VIDEO_INTEGER_SCALE = true;
|
||||
constexpr bool VIDEO_SHADERS = false;
|
||||
|
||||
// Music
|
||||
constexpr bool MUSIC_ENABLED = true;
|
||||
constexpr int MUSIC_VOLUME = 100;
|
||||
|
||||
// Sound
|
||||
constexpr bool SOUND_ENABLED = true;
|
||||
constexpr int SOUND_VOLUME = 100;
|
||||
|
||||
// Audio
|
||||
constexpr bool AUDIO_ENABLED = true;
|
||||
constexpr int AUDIO_VOLUME = 100;
|
||||
|
||||
// Settings
|
||||
constexpr bool SETTINGS_AUTOFIRE = true;
|
||||
constexpr bool SETTINGS_SHUTDOWN_ENABLED = false;
|
||||
} // namespace Options
|
||||
} // namespace GameDefaults
|
||||
@@ -11,9 +11,10 @@
|
||||
#include <stdexcept> // Para out_of_range, invalid_argument
|
||||
#include <string> // Para char_traits, string, allocator, operator==, swap, operator<<, basic_string, stoi
|
||||
#include <string_view> // Para string_view
|
||||
#include <utility>
|
||||
#include <vector> // Para vector
|
||||
#include <utility> // Para swap
|
||||
#include <vector> // Para vector
|
||||
|
||||
#include "defaults.h" // Para GameDefaults
|
||||
#include "difficulty.h" // Para Code
|
||||
#include "input.h" // Para Input
|
||||
#include "lang.h" // Para Code
|
||||
@@ -25,66 +26,46 @@ namespace Options {
|
||||
|
||||
// --- Estructuras ---
|
||||
struct Window {
|
||||
std::string caption; // Texto que aparece en la barra de título de la ventana
|
||||
int zoom{2}; // Valor por el que se multiplica el tamaño de la ventana
|
||||
int max_zoom{2}; // Tamaño máximo para que la ventana no sea mayor que la pantalla
|
||||
|
||||
// Constructor por defecto con valores iniciales
|
||||
Window()
|
||||
: caption("Coffee Crisis Arcade Edition") {}
|
||||
std::string caption = GameDefaults::Options::WINDOW_CAPTION; // Texto que aparece en la barra de título de la ventana
|
||||
int zoom = GameDefaults::Options::WINDOW_ZOOM; // Valor por el que se multiplica el tamaño de la ventana
|
||||
int max_zoom = GameDefaults::Options::WINDOW_MAX_ZOOM; // Tamaño máximo para que la ventana no sea mayor que la pantalla
|
||||
};
|
||||
|
||||
struct Video {
|
||||
SDL_ScaleMode scale_mode{SDL_ScaleMode::SDL_SCALEMODE_NEAREST}; // Filtro usado para el escalado de la imagen
|
||||
bool fullscreen{false}; // Indica si se usa pantalla completa
|
||||
bool vsync{true}; // Indica si se usa vsync
|
||||
bool integer_scale{true}; // Indica si se usa escalado entero
|
||||
bool shaders{false}; // Indica si se usan shaders para los filtros de vídeo
|
||||
std::string info; // Información sobre el modo de vídeo
|
||||
|
||||
// Constructor por defecto con valores iniciales
|
||||
Video() = default;
|
||||
SDL_ScaleMode scale_mode = GameDefaults::Options::VIDEO_SCALE_MODE; // Filtro usado para el escalado de la imagen
|
||||
bool fullscreen = GameDefaults::Options::VIDEO_FULLSCREEN; // Indica si se usa pantalla completa
|
||||
bool vsync = GameDefaults::Options::VIDEO_VSYNC; // Indica si se usa vsync
|
||||
bool integer_scale = GameDefaults::Options::VIDEO_INTEGER_SCALE; // Indica si se usa escalado entero
|
||||
bool shaders = GameDefaults::Options::VIDEO_SHADERS; // Indica si se usan shaders para los filtros de vídeo
|
||||
std::string info; // Información sobre el modo de vídeo
|
||||
};
|
||||
|
||||
struct Music {
|
||||
bool enabled{true}; // Indica si la música suena o no
|
||||
int volume{100}; // Volumen de la música
|
||||
|
||||
// Constructor por defecto
|
||||
Music() = default;
|
||||
bool enabled = GameDefaults::Options::MUSIC_ENABLED; // Indica si la música suena o no
|
||||
int volume = GameDefaults::Options::MUSIC_VOLUME; // Volumen de la música
|
||||
};
|
||||
|
||||
struct Sound {
|
||||
bool enabled{true}; // Indica si los sonidos suenan o no
|
||||
int volume{100}; // Volumen de los sonidos
|
||||
|
||||
// Constructor por defecto
|
||||
Sound() = default;
|
||||
bool enabled = GameDefaults::Options::SOUND_ENABLED; // Indica si los sonidos suenan o no
|
||||
int volume = GameDefaults::Options::SOUND_VOLUME; // Volumen de los sonidos
|
||||
};
|
||||
|
||||
struct Audio {
|
||||
Music music; // Opciones para la música
|
||||
Sound sound; // Opciones para los efectos de sonido
|
||||
bool enabled{true}; // Indica si el audio está activo o no
|
||||
int volume{100}; // Volumen general del audio
|
||||
|
||||
// Constructor por defecto
|
||||
Audio() = default;
|
||||
Music music; // Opciones para la música
|
||||
Sound sound; // Opciones para los efectos de sonido
|
||||
bool enabled = GameDefaults::Options::AUDIO_ENABLED; // Indica si el audio está activo o no
|
||||
int volume = GameDefaults::Options::AUDIO_VOLUME; // Volumen general del audio
|
||||
};
|
||||
|
||||
struct Settings {
|
||||
Difficulty::Code difficulty{Difficulty::Code::NORMAL}; // Dificultad del juego
|
||||
Lang::Code language{Lang::Code::VALENCIAN}; // Idioma usado en el juego
|
||||
bool autofire{true}; // Indicador de autofire
|
||||
bool shutdown_enabled{false}; // Especifica si se puede apagar el sistema
|
||||
Table hi_score_table; // Tabla de mejores puntuaciones
|
||||
std::vector<int> glowing_entries; // Últimas posiciones de entrada en la tabla
|
||||
std::string config_file; // Ruta al fichero donde guardar la configuración y las opciones del juego
|
||||
std::string controllers_file; // Ruta al fichero con las configuraciones de los mandos
|
||||
|
||||
// Constructor por defecto con valores iniciales
|
||||
Settings()
|
||||
: glowing_entries({ManageHiScoreTable::NO_ENTRY, ManageHiScoreTable::NO_ENTRY}) {}
|
||||
Difficulty::Code difficulty = Difficulty::Code::NORMAL; // Dificultad del juego
|
||||
Lang::Code language = Lang::Code::VALENCIAN; // Idioma usado en el juego
|
||||
bool autofire = GameDefaults::Options::SETTINGS_AUTOFIRE; // Indicador de autofire
|
||||
bool shutdown_enabled = GameDefaults::Options::SETTINGS_SHUTDOWN_ENABLED; // Especifica si se puede apagar el sistema
|
||||
Table hi_score_table; // Tabla de mejores puntuaciones
|
||||
std::vector<int> glowing_entries = {ManageHiScoreTable::NO_ENTRY, ManageHiScoreTable::NO_ENTRY}; // Últimas posiciones de entrada en la tabla
|
||||
std::string config_file; // Ruta al fichero donde guardar la configuración y las opciones del juego
|
||||
std::string controllers_file; // Ruta al fichero con las configuraciones de los mandos
|
||||
|
||||
// Reinicia las últimas entradas de puntuación
|
||||
void clearLastHiScoreEntries() {
|
||||
@@ -288,12 +269,9 @@ struct Keyboard {
|
||||
};
|
||||
|
||||
struct PendingChanges {
|
||||
Lang::Code new_language{Lang::Code::VALENCIAN}; // Idioma en espera de aplicar
|
||||
Difficulty::Code new_difficulty{Difficulty::Code::NORMAL}; // Dificultad en espera de aplicar
|
||||
bool has_pending_changes{false}; // Indica si hay cambios pendientes
|
||||
|
||||
// Constructor por defecto con valores iniciales
|
||||
PendingChanges() = default;
|
||||
Lang::Code new_language = Lang::Code::VALENCIAN; // Idioma en espera de aplicar
|
||||
Difficulty::Code new_difficulty = Difficulty::Code::NORMAL; // Dificultad en espera de aplicar
|
||||
bool has_pending_changes = false; // Indica si hay cambios pendientes
|
||||
};
|
||||
|
||||
// --- Variables ---
|
||||
|
||||
Reference in New Issue
Block a user