forked from jaildesigner-jailgames/jaildoctors_dilemma
optimitzats els constructors per defecte en Options
This commit is contained in:
@@ -42,6 +42,9 @@ Screen::Screen()
|
|||||||
: palettes_(Asset::get()->getListByType(Asset::Type::PALETTE)) {
|
: palettes_(Asset::get()->getListByType(Asset::Type::PALETTE)) {
|
||||||
// Arranca SDL VIDEO, crea la ventana y el renderizador
|
// Arranca SDL VIDEO, crea la ventana y el renderizador
|
||||||
initSDLVideo();
|
initSDLVideo();
|
||||||
|
if (Options::video.fullscreen) {
|
||||||
|
SDL_HideCursor();
|
||||||
|
}
|
||||||
|
|
||||||
// Ajusta los tamaños
|
// Ajusta los tamaños
|
||||||
game_surface_dstrect_ = {.x = Options::video.border.width, .y = Options::video.border.height, .w = Options::game.width, .h = Options::game.height};
|
game_surface_dstrect_ = {.x = Options::video.border.width, .y = Options::video.border.height, .w = Options::game.width, .h = Options::game.height};
|
||||||
@@ -71,14 +74,17 @@ Screen::Screen()
|
|||||||
}
|
}
|
||||||
SDL_SetTextureScaleMode(border_texture_, SDL_SCALEMODE_NEAREST);
|
SDL_SetTextureScaleMode(border_texture_, SDL_SCALEMODE_NEAREST);
|
||||||
|
|
||||||
|
// Cargar la paleta una sola vez
|
||||||
|
auto initial_palette = readPalFile(palettes_.at(current_palette_));
|
||||||
|
|
||||||
// Crea la surface donde se dibujan los graficos del juego
|
// Crea la surface donde se dibujan los graficos del juego
|
||||||
game_surface_ = std::make_shared<Surface>(Options::game.width, Options::game.height);
|
game_surface_ = std::make_shared<Surface>(Options::game.width, Options::game.height);
|
||||||
game_surface_->setPalette(readPalFile(palettes_.at(current_palette_)));
|
game_surface_->setPalette(initial_palette);
|
||||||
game_surface_->clear(static_cast<Uint8>(PaletteColor::BLACK));
|
game_surface_->clear(static_cast<Uint8>(PaletteColor::BLACK));
|
||||||
|
|
||||||
// Crea la surface para el borde de colores
|
// Crea la surface para el borde de colores
|
||||||
border_surface_ = std::make_shared<Surface>(Options::game.width + (Options::video.border.width * 2), Options::game.height + (Options::video.border.height * 2));
|
border_surface_ = std::make_shared<Surface>(Options::game.width + (Options::video.border.width * 2), Options::game.height + (Options::video.border.height * 2));
|
||||||
border_surface_->setPalette(readPalFile(palettes_.at(current_palette_)));
|
border_surface_->setPalette(initial_palette);
|
||||||
border_surface_->clear(border_color_);
|
border_surface_->clear(border_color_);
|
||||||
|
|
||||||
// Establece la surface que actuará como renderer para recibir las llamadas a render()
|
// Establece la surface que actuará como renderer para recibir las llamadas a render()
|
||||||
@@ -243,7 +249,7 @@ void Screen::adjustRenderLogicalSize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Establece el renderizador para las surfaces
|
// Establece el renderizador para las surfaces
|
||||||
void Screen::setRendererSurface(const std::shared_ptr<Surface> &surface) {
|
void Screen::setRendererSurface(const std::shared_ptr<Surface>& surface) {
|
||||||
(surface) ? renderer_surface_ = std::make_shared<std::shared_ptr<Surface>>(surface) : renderer_surface_ = std::make_shared<std::shared_ptr<Surface>>(game_surface_);
|
(surface) ? renderer_surface_ = std::make_shared<std::shared_ptr<Surface>>(surface) : renderer_surface_ = std::make_shared<std::shared_ptr<Surface>>(game_surface_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,11 +408,9 @@ void Screen::loadShaders() {
|
|||||||
// Si no existe versión ES, usar versión Desktop
|
// Si no existe versión ES, usar versión Desktop
|
||||||
vertex_file = "crtpi_vertex.glsl";
|
vertex_file = "crtpi_vertex.glsl";
|
||||||
data = loadData(Asset::get()->get(vertex_file));
|
data = loadData(Asset::get()->get(vertex_file));
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
std::cout << "Usando shaders OpenGL Desktop 3.3\n";
|
||||||
"Usando shaders OpenGL Desktop 3.3");
|
|
||||||
} else {
|
} else {
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
std::cout << "Usando shaders OpenGL ES 3.0 (Raspberry Pi)\n";
|
||||||
"Usando shaders OpenGL ES 3.0 (Raspberry Pi)");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data.empty()) {
|
if (!data.empty()) {
|
||||||
@@ -444,8 +448,7 @@ void Screen::initShaders() {
|
|||||||
#else
|
#else
|
||||||
// En macOS, OpenGL está deprecated y rinde mal
|
// En macOS, OpenGL está deprecated y rinde mal
|
||||||
// TODO: Implementar backend de Metal para shaders en macOS
|
// TODO: Implementar backend de Metal para shaders en macOS
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
std::cout << "WARNING: Shaders no disponibles en macOS (OpenGL deprecated). Usa Metal backend.\n";
|
||||||
"Shaders no disponibles en macOS (OpenGL deprecated). Usa Metal backend.");
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,7 +462,7 @@ void Screen::getDisplayInfo() {
|
|||||||
SDL_DisplayID instance_id = displays[i];
|
SDL_DisplayID instance_id = displays[i];
|
||||||
const char* name = SDL_GetDisplayName(instance_id);
|
const char* name = SDL_GetDisplayName(instance_id);
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Display %" SDL_PRIu32 ": %s", instance_id, (name != nullptr) ? name : "Unknown");
|
std::cout << "Display " << instance_id << ": " << ((name != nullptr) ? name : "Unknown") << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto* dm = SDL_GetCurrentDisplayMode(displays[0]);
|
const auto* dm = SDL_GetCurrentDisplayMode(displays[0]);
|
||||||
@@ -476,9 +479,9 @@ void Screen::getDisplayInfo() {
|
|||||||
Options::window.zoom = std::min(Options::window.zoom, Options::window.max_zoom);
|
Options::window.zoom = std::min(Options::window.zoom, Options::window.max_zoom);
|
||||||
|
|
||||||
// Muestra información sobre el tamaño de la pantalla y de la ventana de juego
|
// Muestra información sobre el tamaño de la pantalla y de la ventana de juego
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Current display mode: %dx%d @ %dHz", static_cast<int>(dm->w), static_cast<int>(dm->h), static_cast<int>(dm->refresh_rate));
|
std::cout << "Current display mode: " << static_cast<int>(dm->w) << "x" << static_cast<int>(dm->h) << " @ " << static_cast<int>(dm->refresh_rate) << "Hz\n";
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Window resolution: %dx%d x%d", static_cast<int>(Options::game.width), static_cast<int>(Options::game.height), Options::window.zoom);
|
std::cout << "Window resolution: " << static_cast<int>(Options::game.width) << "x" << static_cast<int>(Options::game.height) << " x" << Options::window.zoom << '\n';
|
||||||
|
|
||||||
Options::video.info = std::to_string(static_cast<int>(dm->w)) + "x" +
|
Options::video.info = std::to_string(static_cast<int>(dm->w)) + "x" +
|
||||||
std::to_string(static_cast<int>(dm->h)) + " @ " +
|
std::to_string(static_cast<int>(dm->h)) + " @ " +
|
||||||
@@ -498,9 +501,7 @@ void Screen::getDisplayInfo() {
|
|||||||
auto Screen::initSDLVideo() -> bool {
|
auto Screen::initSDLVideo() -> bool {
|
||||||
// Inicializar SDL
|
// Inicializar SDL
|
||||||
if (!SDL_Init(SDL_INIT_VIDEO)) {
|
if (!SDL_Init(SDL_INIT_VIDEO)) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
std::cerr << "FATAL: Failed to initialize SDL_VIDEO! SDL Error: " << SDL_GetError() << '\n';
|
||||||
"FATAL: Failed to initialize SDL_VIDEO! SDL Error: %s",
|
|
||||||
SDL_GetError());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -510,14 +511,12 @@ auto Screen::initSDLVideo() -> bool {
|
|||||||
// Configurar hint para renderizado
|
// Configurar hint para renderizado
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "metal")) {
|
if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "metal")) {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
std::cout << "WARNING: Failed to set Metal hint!\n";
|
||||||
"Warning: Failed to set Metal hint!");
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// Configurar hint de render driver
|
// Configurar hint de render driver
|
||||||
if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl")) {
|
if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl")) {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
std::cout << "WARNING: Failed to set OpenGL hint!\n";
|
||||||
"Warning: Failed to set OpenGL hint!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -525,10 +524,10 @@ auto Screen::initSDLVideo() -> bool {
|
|||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Solicitando OpenGL 3.3 Core Profile");
|
std::cout << "Solicitando OpenGL 3.3 Core Profile\n";
|
||||||
#else
|
#else
|
||||||
// Linux: Dejar que SDL elija (Desktop 3.3 en PC, ES 3.0 en RPi automáticamente)
|
// Linux: Dejar que SDL elija (Desktop 3.3 en PC, ES 3.0 en RPi automáticamente)
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Usando OpenGL por defecto del sistema");
|
std::cout << "Usando OpenGL por defecto del sistema\n";
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -546,9 +545,7 @@ auto Screen::initSDLVideo() -> bool {
|
|||||||
window_ = SDL_CreateWindow(Options::window.caption.c_str(), WINDOW_WIDTH * Options::window.zoom, WINDOW_HEIGHT * Options::window.zoom, window_flags);
|
window_ = SDL_CreateWindow(Options::window.caption.c_str(), WINDOW_WIDTH * Options::window.zoom, WINDOW_HEIGHT * Options::window.zoom, window_flags);
|
||||||
|
|
||||||
if (window_ == nullptr) {
|
if (window_ == nullptr) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
std::cerr << "FATAL: Failed to create window! SDL Error: " << SDL_GetError() << '\n';
|
||||||
"FATAL: Failed to create window! SDL Error: %s",
|
|
||||||
SDL_GetError());
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -556,9 +553,7 @@ auto Screen::initSDLVideo() -> bool {
|
|||||||
// Crear renderer
|
// Crear renderer
|
||||||
renderer_ = SDL_CreateRenderer(window_, nullptr);
|
renderer_ = SDL_CreateRenderer(window_, nullptr);
|
||||||
if (renderer_ == nullptr) {
|
if (renderer_ == nullptr) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
std::cerr << "FATAL: Failed to create renderer! SDL Error: " << SDL_GetError() << '\n';
|
||||||
"FATAL: Failed to create renderer! SDL Error: %s",
|
|
||||||
SDL_GetError());
|
|
||||||
SDL_DestroyWindow(window_);
|
SDL_DestroyWindow(window_);
|
||||||
window_ = nullptr;
|
window_ = nullptr;
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
@@ -577,6 +572,6 @@ auto Screen::initSDLVideo() -> bool {
|
|||||||
SDL_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_BLEND);
|
SDL_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_BLEND);
|
||||||
SDL_SetRenderVSync(renderer_, Options::video.vertical_sync ? 1 : SDL_RENDERER_VSYNC_DISABLED);
|
SDL_SetRenderVSync(renderer_, Options::video.vertical_sync ? 1 : SDL_RENDERER_VSYNC_DISABLED);
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "** Video system initialized successfully");
|
std::cout << "** Video system initialized successfully\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ auto Debug::get() -> Debug* {
|
|||||||
|
|
||||||
// Dibuja en pantalla
|
// Dibuja en pantalla
|
||||||
void Debug::render() {
|
void Debug::render() {
|
||||||
auto text = Resource::get()->getText("debug");
|
auto text = Resource::get()->getText("aseprite");
|
||||||
int y = y_;
|
int y = y_;
|
||||||
int w = 0;
|
int w = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ Director::Director(std::vector<std::string> const& args) {
|
|||||||
|
|
||||||
// Crea los objetos
|
// Crea los objetos
|
||||||
Screen::init();
|
Screen::init();
|
||||||
SDL_HideCursor();
|
|
||||||
|
|
||||||
// Initialize resources (works for both release and development)
|
// Initialize resources (works for both release and development)
|
||||||
Resource::init();
|
Resource::init();
|
||||||
|
|||||||
@@ -37,13 +37,11 @@ namespace Options {
|
|||||||
|
|
||||||
// Estructura para las opciones de las notificaciones
|
// Estructura para las opciones de las notificaciones
|
||||||
struct Notification {
|
struct Notification {
|
||||||
bool sound; // Indica si las notificaciones suenan
|
bool sound{GameDefaults::NOTIFICATION_SOUND}; // Indica si las notificaciones suenan
|
||||||
Uint8 color; // Color de las notificaciones
|
Uint8 color{GameDefaults::NOTIFICATION_COLOR}; // Color de las notificaciones
|
||||||
|
|
||||||
// Constructor por defecto
|
// Constructor por defecto
|
||||||
Notification()
|
Notification() = default;
|
||||||
: sound(GameDefaults::NOTIFICATION_SOUND),
|
|
||||||
color(GameDefaults::NOTIFICATION_COLOR) {}
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Notification(bool s, Uint8 c)
|
Notification(bool s, Uint8 c)
|
||||||
@@ -58,17 +56,13 @@ struct Cheat {
|
|||||||
ENABLED = true
|
ENABLED = true
|
||||||
};
|
};
|
||||||
|
|
||||||
State infinite_lives; // Indica si el jugador dispone de vidas infinitas
|
State infinite_lives{State::DISABLED}; // Indica si el jugador dispone de vidas infinitas
|
||||||
State invincible; // Indica si el jugador puede morir
|
State invincible{State::DISABLED}; // Indica si el jugador puede morir
|
||||||
State jail_is_open; // Indica si la Jail está abierta
|
State jail_is_open{State::DISABLED}; // Indica si la Jail está abierta
|
||||||
State alternate_skin; // Indica si se usa una skin diferente para el jugador
|
State alternate_skin{State::DISABLED}; // Indica si se usa una skin diferente para el jugador
|
||||||
|
|
||||||
// Constructor por defecto
|
// Constructor por defecto
|
||||||
Cheat()
|
Cheat() = default;
|
||||||
: infinite_lives(State::DISABLED),
|
|
||||||
invincible(State::DISABLED),
|
|
||||||
jail_is_open(State::DISABLED),
|
|
||||||
alternate_skin(State::DISABLED) {}
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Cheat(State inf_lives, State is_invincible, State jail_enabled, State alt_skin)
|
Cheat(State inf_lives, State is_invincible, State jail_enabled, State alt_skin)
|
||||||
@@ -87,14 +81,12 @@ struct Cheat {
|
|||||||
|
|
||||||
// Estructura para almacenar estadísticas
|
// Estructura para almacenar estadísticas
|
||||||
struct Stats {
|
struct Stats {
|
||||||
int rooms; // Cantidad de habitaciones visitadas
|
int rooms{0}; // Cantidad de habitaciones visitadas
|
||||||
int items; // Cantidad de items obtenidos
|
int items{0}; // Cantidad de items obtenidos
|
||||||
std::string worst_nightmare; // Habitación con más muertes acumuladas
|
std::string worst_nightmare; // Habitación con más muertes acumuladas
|
||||||
|
|
||||||
// Constructor por defecto
|
// Constructor por defecto
|
||||||
Stats()
|
Stats() = default;
|
||||||
: rooms(0),
|
|
||||||
items(0) {}
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Stats(int room_count, int item_count, std::string worst_nightmare_room)
|
Stats(int room_count, int item_count, std::string worst_nightmare_room)
|
||||||
@@ -105,15 +97,12 @@ struct Stats {
|
|||||||
|
|
||||||
// Estructura con opciones de la ventana
|
// Estructura con opciones de la ventana
|
||||||
struct Window {
|
struct Window {
|
||||||
std::string caption; // Texto que aparece en la barra de título de la ventana
|
std::string caption{"JailDoctor's Dilemma"}; // Texto que aparece en la barra de título de la ventana
|
||||||
int zoom; // Zoom de la ventana
|
int zoom{GameDefaults::WINDOW_ZOOM}; // Zoom de la ventana
|
||||||
int max_zoom; // Máximo tamaño de zoom para la ventana
|
int max_zoom{GameDefaults::WINDOW_ZOOM}; // Máximo tamaño de zoom para la ventana
|
||||||
|
|
||||||
// Constructor por defecto
|
// Constructor por defecto
|
||||||
Window()
|
Window() = default;
|
||||||
: caption("JailDoctor's Dilemma"),
|
|
||||||
zoom(GameDefaults::WINDOW_ZOOM),
|
|
||||||
max_zoom(GameDefaults::WINDOW_ZOOM) {}
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Window(int window_zoom, int maximum_zoom)
|
Window(int window_zoom, int maximum_zoom)
|
||||||
@@ -124,15 +113,12 @@ struct Window {
|
|||||||
|
|
||||||
// Estructura para gestionar el borde de la pantalla
|
// Estructura para gestionar el borde de la pantalla
|
||||||
struct Border {
|
struct Border {
|
||||||
bool enabled; // Indica si se ha de mostrar el borde
|
bool enabled{GameDefaults::BORDER_ENABLED}; // Indica si se ha de mostrar el borde
|
||||||
float width; // Ancho del borde
|
float width{GameDefaults::BORDER_WIDTH}; // Ancho del borde
|
||||||
float height; // Alto del borde
|
float height{GameDefaults::BORDER_HEIGHT}; // Alto del borde
|
||||||
|
|
||||||
// Constructor por defecto
|
// Constructor por defecto
|
||||||
Border()
|
Border() = default;
|
||||||
: enabled(GameDefaults::BORDER_ENABLED),
|
|
||||||
width(GameDefaults::BORDER_WIDTH),
|
|
||||||
height(GameDefaults::BORDER_HEIGHT) {}
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Border(bool is_enabled, float border_width, float border_height)
|
Border(bool is_enabled, float border_width, float border_height)
|
||||||
@@ -143,26 +129,18 @@ struct Border {
|
|||||||
|
|
||||||
// Estructura para las opciones de video
|
// Estructura para las opciones de video
|
||||||
struct Video {
|
struct Video {
|
||||||
bool fullscreen; // Contiene el valor del modo de pantalla completa
|
bool fullscreen{GameDefaults::VIDEO_MODE}; // Contiene el valor del modo de pantalla completa
|
||||||
ScreenFilter filter; // Filtro usado para el escalado de la imagen
|
ScreenFilter filter{GameDefaults::VIDEO_FILTER}; // Filtro usado para el escalado de la imagen
|
||||||
bool vertical_sync; // Indica si se quiere usar vsync o no
|
bool vertical_sync{GameDefaults::VIDEO_VERTICAL_SYNC}; // Indica si se quiere usar vsync o no
|
||||||
bool shaders; // Indica si se van a usar shaders o no
|
bool shaders{GameDefaults::VIDEO_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 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; // Indica si se ha de mantener la relación de aspecto al poner 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
|
Border border; // Borde de la pantalla
|
||||||
std::string palette; // Paleta de colores a usar en el juego
|
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
|
std::string info; // Información sobre el modo de vídeo
|
||||||
|
|
||||||
// Constructor por defecto
|
// Constructor por defecto
|
||||||
Video()
|
Video() = default;
|
||||||
: 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) {}
|
|
||||||
|
|
||||||
// Constructor
|
// 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)
|
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
|
// Estructura para las opciones de musica
|
||||||
struct Music {
|
struct Music {
|
||||||
bool enabled; // Indica si la música suena o no
|
bool enabled{GameDefaults::MUSIC_ENABLED}; // Indica si la música suena o no
|
||||||
int volume; // Volumen al que suena la música (0 a 128 internamente)
|
int volume{VolumeHelpers::convertVolume(GameDefaults::MUSIC_VOLUME)}; // Volumen al que suena la música (0 a 128 internamente)
|
||||||
|
|
||||||
// Constructor por defecto
|
// Constructor por defecto
|
||||||
Music()
|
Music() = default;
|
||||||
: enabled(GameDefaults::MUSIC_ENABLED),
|
|
||||||
volume(VolumeHelpers::convertVolume(GameDefaults::MUSIC_VOLUME)) {}
|
|
||||||
|
|
||||||
// Constructor con parámetros
|
// Constructor con parámetros
|
||||||
Music(bool is_enabled, int volume_percent)
|
Music(bool is_enabled, int volume_percent)
|
||||||
@@ -200,13 +176,11 @@ struct Music {
|
|||||||
|
|
||||||
// Estructura para las opciones de sonido
|
// Estructura para las opciones de sonido
|
||||||
struct Sound {
|
struct Sound {
|
||||||
bool enabled; // Indica si los sonidos suenan o no
|
bool enabled{GameDefaults::SOUND_ENABLED}; // Indica si los sonidos suenan o no
|
||||||
int volume; // Volumen al que suenan los sonidos (0 a 128 internamente)
|
int volume{VolumeHelpers::convertVolume(GameDefaults::SOUND_VOLUME)}; // Volumen al que suenan los sonidos (0 a 128 internamente)
|
||||||
|
|
||||||
// Constructor por defecto
|
// Constructor por defecto
|
||||||
Sound()
|
Sound() = default;
|
||||||
: enabled(GameDefaults::SOUND_ENABLED),
|
|
||||||
volume(VolumeHelpers::convertVolume(GameDefaults::SOUND_VOLUME)) {}
|
|
||||||
|
|
||||||
// Constructor con parámetros
|
// Constructor con parámetros
|
||||||
Sound(bool is_enabled, int volume_percent)
|
Sound(bool is_enabled, int volume_percent)
|
||||||
@@ -222,15 +196,13 @@ struct Sound {
|
|||||||
|
|
||||||
// Estructura para las opciones de audio
|
// Estructura para las opciones de audio
|
||||||
struct Audio {
|
struct Audio {
|
||||||
Music music; // Opciones para la música
|
Music music; // Opciones para la música
|
||||||
Sound sound; // Opciones para los efectos de sonido
|
Sound sound; // Opciones para los efectos de sonido
|
||||||
bool enabled; // Indica si el audio está activo o no
|
bool enabled{GameDefaults::AUDIO_ENABLED}; // Indica si el audio está activo o no
|
||||||
int volume; // Volumen al que suenan el audio (0-128 internamente)
|
int volume{VolumeHelpers::convertVolume(GameDefaults::AUDIO_VOLUME)}; // Volumen al que suenan el audio (0-128 internamente)
|
||||||
|
|
||||||
// Constructor por defecto
|
// Constructor por defecto
|
||||||
Audio()
|
Audio() = default;
|
||||||
: enabled(GameDefaults::AUDIO_ENABLED),
|
|
||||||
volume(VolumeHelpers::convertVolume(GameDefaults::AUDIO_VOLUME)) {}
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Audio(Music audio_music, Sound audio_sound, bool is_enabled, int volume_percent)
|
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
|
// Estructura para las opciones de juego
|
||||||
struct Game {
|
struct Game {
|
||||||
float width; // Ancho de la resolucion del juego
|
float width{GameDefaults::GAME_WIDTH}; // Ancho de la resolucion del juego
|
||||||
float height; // Alto de la resolucion del juego
|
float height{GameDefaults::GAME_HEIGHT}; // Alto de la resolucion del juego
|
||||||
|
|
||||||
// Constructor por defecto
|
// Constructor por defecto
|
||||||
Game()
|
Game() = default;
|
||||||
: width(GameDefaults::GAME_WIDTH),
|
|
||||||
height(GameDefaults::GAME_HEIGHT) {}
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Game(float game_width, float game_height)
|
Game(float game_width, float game_height)
|
||||||
|
|||||||
Reference in New Issue
Block a user