71 lines
2.5 KiB
C++
71 lines
2.5 KiB
C++
// engine_config.hpp - Configuració runtime del motor (window, render, input)
|
||
// © 2026 JailDesigner
|
||
//
|
||
// Struct POD que conté la configuració runtime que els sistemes de `core/`
|
||
// llegeixen i muten. La capa de persistència (YAML) viu a `game/config_yaml.cpp`,
|
||
// que omple aquesta struct a init() i loadFromFile().
|
||
//
|
||
// Es passa per referència (mutable quan cal) al constructor dels sistemes
|
||
// que la necessiten, mantenint `core/` agnòstic a `game/`.
|
||
|
||
#pragma once
|
||
|
||
#include <SDL3/SDL.h>
|
||
|
||
#include <string>
|
||
|
||
namespace Config {
|
||
|
||
struct WindowConfig {
|
||
int width{1280};
|
||
int height{720};
|
||
bool fullscreen{false};
|
||
float zoom_factor{1.0F}; // Zoom level (0.5x to max_zoom)
|
||
};
|
||
|
||
struct RenderingConfig {
|
||
int vsync{1}; // 0=disabled, 1=enabled
|
||
int antialias{1}; // 0=disabled, 1=enabled (AA geomètric a les línies, toggle F5)
|
||
// Resolució del render target offscreen (independent del tamany lògic
|
||
// 1280×720 del joc). Aquesta és la resolució real on rasteritzen les
|
||
// línies abans de l'escala final a la swapchain; pujar-la millora
|
||
// la nitidesa en finestres grans i fullscreen. Llista tancada de
|
||
// presets 16:9 — veure Defaults::Rendering::RESOLUTION_PRESETS.
|
||
int render_width{1280};
|
||
int render_height{720};
|
||
};
|
||
|
||
struct KeyboardBindings {
|
||
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 GamepadBindings {
|
||
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 PlayerBindings {
|
||
KeyboardBindings keyboard{};
|
||
GamepadBindings gamepad{};
|
||
std::string gamepad_name; // Empty = auto-assign by index
|
||
};
|
||
|
||
struct EngineConfig {
|
||
WindowConfig window{};
|
||
RenderingConfig rendering{};
|
||
PlayerBindings player1{};
|
||
PlayerBindings player2{};
|
||
KeyboardBindings keyboard_controls{}; // Defaults globals per Input
|
||
GamepadBindings gamepad_controls{};
|
||
bool console{false};
|
||
std::string locale{"ca"}; // "ca" | "en" — fixat a l'arrencada, sense hot-swap
|
||
};
|
||
|
||
} // namespace Config
|