Fase 1c: rename d'escenes i sistema d'escenes
Tots els tipus, fitxers, namespace, enums i metodes relacionats amb
les escenes passen del catala a l'angles seguint el .clang-tidy:
Fitxers (renames git):
- source/game/escenes/escena_joc.{hpp,cpp} -> game/scenes/game_scene.{hpp,cpp}
- source/game/escenes/escena_titol.{hpp,cpp} -> game/scenes/title_scene.{hpp,cpp}
- source/game/escenes/escena_logo.{hpp,cpp} -> game/scenes/logo_scene.{hpp,cpp}
- source/core/system/context_escenes.hpp -> core/system/scene_context.hpp
- Carpeta game/escenes/ -> game/scenes/
Tipus (CamelCase):
- EscenaJoc -> GameScene
- EscenaTitol -> TitleScene
- EscenaLogo -> LogoScene
- ContextEscenes -> SceneContext
- Escena (enum class) -> SceneType
- Opcio -> Option
- EstatGameOver -> GameOverState
- EstatTitol -> TitleState
- EstatAnimacio -> AnimationState
- ConfigPartida -> MatchConfig
Namespace:
- GestorEscenes -> SceneManager
Valors d'enum SceneType:
- TITOL -> TITLE
- JOC -> GAME
- EIXIR -> EXIT
(LOGO mantingut)
Metodes (camelBack):
- executar -> run
- canviar_escena -> setNextScene
- escena_desti -> nextScene
- opcio (getter) -> option
- consumir_opcio -> consumeOption
- reset_opcio -> resetOption
- set_config_partida -> setMatchConfig
- get_config_partida -> getMatchConfig
Camps privats (lower_case_):
- escena_desti_ -> next_scene_
- opcio_ -> option_
- config_partida_ -> match_config_
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
#include "context_escenes.hpp"
|
||||
#include "scene_context.hpp"
|
||||
#include "core/audio/audio.hpp"
|
||||
#include "core/audio/audio_cache.hpp"
|
||||
#include "core/defaults.hpp"
|
||||
@@ -17,9 +17,9 @@
|
||||
#include "core/resources/resource_helper.hpp"
|
||||
#include "core/resources/resource_loader.hpp"
|
||||
#include "core/utils/path_utils.hpp"
|
||||
#include "game/escenes/escena_joc.hpp"
|
||||
#include "game/escenes/escena_logo.hpp"
|
||||
#include "game/escenes/escena_titol.hpp"
|
||||
#include "game/scenes/game_scene.hpp"
|
||||
#include "game/scenes/logo_scene.hpp"
|
||||
#include "game/scenes/title_scene.hpp"
|
||||
#include "game/options.hpp"
|
||||
#include "project.h"
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#endif
|
||||
|
||||
// Using declarations per simplificar el codi
|
||||
using GestorEscenes::ContextEscenes;
|
||||
using Escena = ContextEscenes::Escena;
|
||||
using SceneManager::SceneContext;
|
||||
using SceneType = SceneContext::SceneType;
|
||||
|
||||
// Constructor
|
||||
Director::Director(std::vector<std::string> const& args) {
|
||||
@@ -238,35 +238,35 @@ auto Director::run() -> int {
|
||||
}
|
||||
|
||||
// Crear context d'escenes
|
||||
ContextEscenes context;
|
||||
SceneContext context;
|
||||
#ifdef _DEBUG
|
||||
context.canviar_escena(Escena::TITOL);
|
||||
context.setNextScene(SceneType::TITLE);
|
||||
#else
|
||||
context.canviar_escena(Escena::LOGO);
|
||||
context.setNextScene(SceneType::LOGO);
|
||||
#endif
|
||||
|
||||
// Bucle principal de gestió d'escenes
|
||||
while (context.escena_desti() != Escena::EIXIR) {
|
||||
// Sincronitzar GestorEscenes::actual amb context
|
||||
// (altres sistemes encara poden llegir GestorEscenes::actual)
|
||||
GestorEscenes::actual = context.escena_desti();
|
||||
while (context.nextScene() != SceneType::EXIT) {
|
||||
// Sincronitzar SceneManager::actual amb context
|
||||
// (altres sistemes encara poden llegir SceneManager::actual)
|
||||
SceneManager::actual = context.nextScene();
|
||||
|
||||
switch (context.escena_desti()) {
|
||||
case Escena::LOGO: {
|
||||
EscenaLogo logo(sdl, context);
|
||||
logo.executar();
|
||||
switch (context.nextScene()) {
|
||||
case SceneType::LOGO: {
|
||||
LogoScene logo(sdl, context);
|
||||
logo.run();
|
||||
break;
|
||||
}
|
||||
|
||||
case Escena::TITOL: {
|
||||
EscenaTitol titol(sdl, context);
|
||||
titol.executar();
|
||||
case SceneType::TITLE: {
|
||||
TitleScene titol(sdl, context);
|
||||
titol.run();
|
||||
break;
|
||||
}
|
||||
|
||||
case Escena::JOC: {
|
||||
EscenaJoc joc(sdl, context);
|
||||
joc.executar();
|
||||
case SceneType::GAME: {
|
||||
GameScene joc(sdl, context);
|
||||
joc.run();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -275,8 +275,8 @@ auto Director::run() -> int {
|
||||
}
|
||||
}
|
||||
|
||||
// Sincronitzar final amb GestorEscenes::actual
|
||||
GestorEscenes::actual = Escena::EIXIR;
|
||||
// Sincronitzar final amb SceneManager::actual
|
||||
SceneManager::actual = SceneType::EXIT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user