5871d29d48
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>
56 lines
1.6 KiB
C++
56 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
namespace GameConfig {
|
|
|
|
// Mode de joc
|
|
enum class Mode {
|
|
NORMAL, // Partida normal
|
|
DEMO // Mode demostració (futur)
|
|
};
|
|
|
|
// Configuració d'una partida
|
|
struct MatchConfig {
|
|
bool jugador1_actiu{false}; // És actiu el jugador 1?
|
|
bool jugador2_actiu{false}; // És actiu el jugador 2?
|
|
Mode mode{Mode::NORMAL}; // Mode de joc
|
|
|
|
// Mètodes auxiliars
|
|
|
|
// Retorna true si només hi ha un jugador actiu
|
|
[[nodiscard]] bool es_un_jugador() const {
|
|
return (jugador1_actiu && !jugador2_actiu) ||
|
|
(!jugador1_actiu && jugador2_actiu);
|
|
}
|
|
|
|
// Retorna true si hi ha dos jugadors actius
|
|
[[nodiscard]] bool son_dos_jugadors() const {
|
|
return jugador1_actiu && jugador2_actiu;
|
|
}
|
|
|
|
// Retorna true si no hi ha cap jugador actiu
|
|
[[nodiscard]] bool cap_jugador() const {
|
|
return !jugador1_actiu && !jugador2_actiu;
|
|
}
|
|
|
|
// Compte de jugadors actius (0, 1 o 2)
|
|
[[nodiscard]] uint8_t compte_jugadors() const {
|
|
return (jugador1_actiu ? 1 : 0) + (jugador2_actiu ? 1 : 0);
|
|
}
|
|
|
|
// Retorna l'ID de l'únic jugador actiu (0 o 1)
|
|
// Només vàlid si es_un_jugador() retorna true
|
|
[[nodiscard]] uint8_t id_unic_jugador() const {
|
|
if (jugador1_actiu && !jugador2_actiu) {
|
|
return 0;
|
|
}
|
|
if (!jugador1_actiu && jugador2_actiu) {
|
|
return 1;
|
|
}
|
|
return 0; // Fallback (cal comprovar es_un_jugador() primer)
|
|
}
|
|
};
|
|
|
|
} // namespace GameConfig
|