Files
orni-attack/source/game/options.hpp
T
JailDesigner bf83f161b0 Fase 1e: cierre de naming sweep (#pragma once, locals, comentarios castellano)
Tres tareas de pulido para cerrar la Fase 1 por completo:

#pragma once uniforme:
- sdl_manager.hpp y game_scene.hpp pasan de #ifndef/#define guards
  a #pragma once. Los archivos externos (stb_vorbis.h, fkyaml_node.hpp)
  se mantienen intactos (codigo de terceros).

Variables locales y parametros restantes (catalan -> ingles):
- fitxer -> file, moviment -> movement, inici -> start
- comptador -> counter, escalada -> scaled
- missatges -> messages, llista -> list
- alçada -> height, amplada -> width, llargada -> length
- origen -> origin, distancia -> distance, valor -> value, desti -> target
- neteja -> clear, presenta -> present (SDLManager)
- total_enemics -> total_enemies, configurar -> configure, iniciar -> start

Comentarios catalan -> castellano:
- Cabeceras de fichero actualizadas con nombres nuevos
  (escena_joc.hpp -> game_scene.hpp, etc.)
- Palabras tecnicas: trasllacio->traslacion, col-lisio->colision,
  inicialitzacio->inicializacion, posicio->posicion, rotacio->rotacion,
  velocitat->velocidad, acceleracio->aceleracion, explosio->explosion,
  renderitzat->renderizado, calcul->calculo, transicio->transicion,
  comprovacio->comprobacion, substitucio->sustitucion,
  utilitzacio->utilizacion, opcio->opcion, configuracio->configuracion,
  funcio->funcion, distancia, animacio->animacion
- Determinantes y conectores: aquest->este, aquesta->esta,
  amb->con, sense->sin, pero->pero, mai->nunca, nomes->solo,
  tambe->tambien, sempre->siempre, ja->ya, mateix->mismo,
  vegada->vez, dintre->dentro, fora->fuera, dreta->derecha,
  esquerra->izquierda, sortir->salir, sortida->salida,
  petit->pequeno, gran->grande, nou->nuevo, vell->viejo,
  molt->mucho, els->los, les->las, totes les->todas las,
  d'->de, com->como, quan->cuando, mentre->mientras,
  despres->despues, abans->antes, durant->durante, fins->hasta,
  encara->aun, llavors->entonces, aixi->asi, perque->porque
- Sustantivos: classe->clase, metode->metodo, parametre->parametro,
  versio->version, entitat->entidad, joc->juego, nivell->nivel,
  enemic->enemigo, naus->naves, bales->balas, fitxer->archivo,
  pentagon->pentagono, pun- tuacio->puntuacion, flotant->flotante,
  titol->titulo, objectiu->objetivo, mostra->muestra, tipus->tipo

Strings literales preservados en valenciano segun decision del
usuario: el texto del HUD del juego (puntuaciones, mensajes en
pantalla, archivo de config) se mantiene en valenciano original.

70 fitxers tocats, +1117 / -1123. Compila i enllaca.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 12:12:30 +02:00

122 lines
3.2 KiB
C++

#pragma once
#include <SDL3/SDL.h> // Para SDL_Scancode
#include <string>
namespace Options {
// Estructures de configuración
struct Window {
int width{640};
int height{480};
bool fullscreen{false};
float zoom_factor{1.0F}; // Zoom level (0.5x to max_zoom)
};
struct Physics {
float rotation_speed{3.14F}; // rad/s
float acceleration{400.0F}; // px/s²
float max_velocity{120.0F}; // px/s
float friction{20.0F}; // px/s²
float enemy_speed{2.0F}; // unitats/frame
float bullet_speed{6.0F}; // unitats/frame
};
struct Gameplay {
int max_enemies{15};
int max_bullets{3};
};
struct Rendering {
int vsync{1}; // 0=disabled, 1=enabled
};
struct Music {
bool enabled{true};
float volume{0.8F};
};
struct Sound {
bool enabled{true};
float volume{1.0F};
};
struct Audio {
Music music{};
Sound sound{};
bool enabled{true};
float volume{1.0F};
};
// Controles de jugadors
struct KeyboardControls {
SDL_Scancode key_left{SDL_SCANCODE_LEFT};
SDL_Scancode key_right{SDL_SCANCODE_RIGHT};
SDL_Scancode key_thrust{SDL_SCANCODE_UP};
SDL_Scancode key_shoot{SDL_SCANCODE_SPACE};
SDL_Scancode key_start{SDL_SCANCODE_1};
};
struct GamepadControls {
int button_left{SDL_GAMEPAD_BUTTON_DPAD_LEFT};
int button_right{SDL_GAMEPAD_BUTTON_DPAD_RIGHT};
int button_thrust{SDL_GAMEPAD_BUTTON_WEST}; // X button
int button_shoot{SDL_GAMEPAD_BUTTON_SOUTH}; // A button
};
struct PlayerControls {
KeyboardControls keyboard{};
GamepadControls gamepad{};
std::string gamepad_name; // Buit = auto-assignar per índex
};
// Variables globals (inline per evitar ODR violations)
inline std::string version{}; // Versión del config per validació
inline bool console{false}; // Eixida de debug
inline Window window{};
inline Physics physics{};
inline Gameplay gameplay{};
inline Rendering rendering{};
inline Audio audio{};
// Controles per player
inline PlayerControls player1{
.keyboard =
{.key_left = SDL_SCANCODE_LEFT,
.key_right = SDL_SCANCODE_RIGHT,
.key_thrust = SDL_SCANCODE_UP,
.key_shoot = SDL_SCANCODE_SPACE,
.key_start = SDL_SCANCODE_1},
.gamepad_name = "" // Primer gamepad disponible
};
inline PlayerControls player2{
.keyboard =
{.key_left = SDL_SCANCODE_A,
.key_right = SDL_SCANCODE_D,
.key_thrust = SDL_SCANCODE_W,
.key_shoot = SDL_SCANCODE_LSHIFT,
.key_start = SDL_SCANCODE_2},
.gamepad_name = "" // Segon gamepad disponible
};
// Per compatibilitat con pollo (no utilitzat en orni, pero necessari per Input)
inline KeyboardControls keyboard_controls{};
inline GamepadControls gamepad_controls{};
inline std::string config_file_path{}; // Establert per setConfigFile()
// Funciones públiques
void init(); // Inicialitzar con valors per defecte
void setConfigFile(
const std::string& path); // Establir ruta del file de config
auto loadFromFile() -> bool; // Carregar config YAML
auto saveToFile() -> bool; // Guardar config YAML
} // namespace Options