canviat Options de struct a namespace

This commit is contained in:
2025-10-26 14:01:08 +01:00
parent 8f49e442de
commit df4965a84b
59 changed files with 1470 additions and 1533 deletions

View File

@@ -4,18 +4,18 @@
#include <algorithm> // Para clamp
#include "game/gameplay/cheevos.hpp" // Para Cheevos, Achievement
#include "utils/defines.hpp" // Para PLAY_AREA_CENTER_X, GAMECANVAS_WIDTH
#include "utils/global_events.hpp" // Para check
#include "core/input/global_inputs.hpp" // Para check
#include "core/input/input.hpp" // Para Input, InputAction, INPUT_DO_NOT_ALLOW_REPEAT, REP...
#include "game/gameplay/options.hpp" // Para Options, options, SectionState, Section
#include "core/resources/resource.hpp" // Para Resource
#include "core/rendering/screen.hpp" // Para Screen
#include "core/input/global_inputs.hpp" // Para check
#include "core/input/input.hpp" // Para Input, InputAction, INPUT_DO_NOT_ALLOW_REPEAT, REP...
#include "core/rendering/screen.hpp" // Para Screen
#include "core/rendering/surface.hpp" // Para Surface
#include "core/rendering/surface_sprite.hpp" // Para SSprite
#include "core/rendering/surface.hpp" // Para Surface
#include "core/rendering/text.hpp" // Para Text, TEXT_CENTER, TEXT_COLOR
#include "utils/utils.hpp" // Para stringToColor, PaletteColor, playMusic
#include "core/rendering/text.hpp" // Para Text, TEXT_CENTER, TEXT_COLOR
#include "core/resources/resource.hpp" // Para Resource
#include "game/gameplay/cheevos.hpp" // Para Cheevos, Achievement
#include "game/gameplay/options.hpp" // Para Options, options, SectionState, Section
#include "utils/defines.hpp" // Para PLAY_AREA_CENTER_X, GAMECANVAS_WIDTH
#include "utils/global_events.hpp" // Para check
#include "utils/utils.hpp" // Para stringToColor, PaletteColor, playMusic
// Constructor
Title::Title()
@@ -23,11 +23,11 @@ Title::Title()
title_logo_sprite_(std::make_shared<SSprite>(title_logo_surface_, 29, 9, title_logo_surface_->getWidth(), title_logo_surface_->getHeight())),
loading_screen_surface_(Resource::get()->getSurface("loading_screen_color.gif")),
loading_screen_sprite_(std::make_shared<SSprite>(loading_screen_surface_, 0, 0, loading_screen_surface_->getWidth(), loading_screen_surface_->getHeight())),
bg_surface_(std::make_shared<Surface>(options.game.width, options.game.height)) {
bg_surface_(std::make_shared<Surface>(Options::game.width, Options::game.height)) {
// Inicializa variables
state_ = options.section.subsection == Subsection::TITLE_WITH_LOADING_SCREEN ? TitleState::SHOW_LOADING_SCREEN : TitleState::SHOW_MENU;
options.section.section = Section::TITLE;
options.section.subsection = Subsection::NONE;
state_ = Options::section.subsection == Options::SceneOptions::TITLE_WITH_LOADING_SCREEN ? TitleState::SHOW_LOADING_SCREEN : TitleState::SHOW_MENU;
Options::section.section = Options::Scene::TITLE;
Options::section.subsection = Options::SceneOptions::NONE;
initMarquee();
// Crea y rellena la textura para mostrar los logros
@@ -68,8 +68,8 @@ void Title::checkEvents() {
if (!show_cheevos_) {
switch (event.key.key) {
case SDLK_1:
options.section.section = Section::GAME;
options.section.subsection = Subsection::NONE;
Options::section.section = Options::Scene::GAME;
Options::section.subsection = Options::SceneOptions::NONE;
break;
case SDLK_2:
@@ -180,8 +180,8 @@ void Title::update() {
// Si el contador alcanza cierto valor, termina la seccion
if (counter_ == 2200) {
if (!show_cheevos_) {
options.section.section = Section::CREDITS;
options.section.subsection = Subsection::NONE;
Options::section.section = Options::Scene::CREDITS;
Options::section.subsection = Options::SceneOptions::NONE;
}
}
break;
@@ -228,7 +228,7 @@ void Title::render() {
// Bucle para el logo del juego
void Title::run() {
while (options.section.section == Section::TITLE) {
while (Options::section.section == Options::Scene::TITLE) {
update();
checkEvents();
render();