forked from jaildesigner-jailgames/jaildoctors_dilemma
mogut options.section a SceneManager
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
#include "game/scene_manager.hpp" // Para SceneManager
|
||||
|
||||
#include "game/scenes/title.hpp"
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
@@ -25,9 +27,9 @@ Title::Title()
|
||||
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)) {
|
||||
// Inicializa variables
|
||||
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;
|
||||
state_ = SceneManager::options == SceneManager::Options::TITLE_WITH_LOADING_SCREEN ? TitleState::SHOW_LOADING_SCREEN : TitleState::SHOW_MENU;
|
||||
SceneManager::current = SceneManager::Scene::TITLE;
|
||||
SceneManager::options = SceneManager::Options::NONE;
|
||||
initMarquee();
|
||||
|
||||
// Crea y rellena la textura para mostrar los logros
|
||||
@@ -68,8 +70,8 @@ void Title::checkEvents() {
|
||||
if (!show_cheevos_) {
|
||||
switch (event.key.key) {
|
||||
case SDLK_1:
|
||||
Options::section.section = Options::Scene::GAME;
|
||||
Options::section.subsection = Options::SceneOptions::NONE;
|
||||
SceneManager::current = SceneManager::Scene::GAME;
|
||||
SceneManager::options = SceneManager::Options::NONE;
|
||||
break;
|
||||
|
||||
case SDLK_2:
|
||||
@@ -180,8 +182,8 @@ void Title::update() {
|
||||
// Si el contador alcanza cierto valor, termina la seccion
|
||||
if (counter_ == 2200) {
|
||||
if (!show_cheevos_) {
|
||||
Options::section.section = Options::Scene::CREDITS;
|
||||
Options::section.subsection = Options::SceneOptions::NONE;
|
||||
SceneManager::current = SceneManager::Scene::CREDITS;
|
||||
SceneManager::options = SceneManager::Options::NONE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -228,7 +230,7 @@ void Title::render() {
|
||||
|
||||
// Bucle para el logo del juego
|
||||
void Title::run() {
|
||||
while (Options::section.section == Options::Scene::TITLE) {
|
||||
while (SceneManager::current == SceneManager::Scene::TITLE) {
|
||||
update();
|
||||
checkEvents();
|
||||
render();
|
||||
|
||||
Reference in New Issue
Block a user