Files
aee-arcade/source/utils/defaults.hpp
T

170 lines
8.4 KiB
C++

#pragma once
#include <SDL3/SDL.h>
#include <cstdint>
namespace Defaults {
// Mode de presentació lògica (escala finestra). Mapeja als valors de
// SDL_RendererLogicalPresentation des de Screen via una funció helper,
// perquè aquest header no depengui de detalls de SDL3 més enllà del scancode.
enum class ScalingMode : std::uint8_t {
DISABLED = 0,
STRETCH = 1,
LETTERBOX = 2,
OVERSCAN = 3,
INTEGER = 4,
};
// Filtre de textura per a l'upscale final.
enum class TextureFilter : std::uint8_t {
NEAREST = 0,
LINEAR = 1,
};
// Posició de l'overlay RenderInfo: apagat, a dalt o a baix del canvas.
// Cicle OFF → TOP → BOTTOM → OFF amb la hotkey corresponent.
enum class RenderInfoPosition : std::uint8_t {
OFF = 0,
TOP = 1,
BOTTOM = 2,
};
constexpr int RENDER_INFO_POSITION_COUNT = 3;
namespace Window {
constexpr int ZOOM = 3;
constexpr bool FULLSCREEN = false;
} // namespace Window
namespace I18n {
constexpr const char* LOCALE = "ca"; // Idioma per defecte (codi ISO 639-1).
constexpr const char* LOCALE_DIR = "data/locale/"; // Carpeta amb els YAML per idioma.
} // namespace I18n
namespace Video {
constexpr bool VSYNC = true;
constexpr ScalingMode SCALING_MODE = ScalingMode::LETTERBOX;
constexpr TextureFilter TEXTURE_FILTER = TextureFilter::NEAREST;
constexpr bool GPU_ACCELERATION = true; // Path SDL3 GPU per defecte; fallback a SDL_Renderer si falla.
constexpr const char* GPU_PREFERRED_DRIVER = ""; // Buit = auto. Aplica a l'arrencada.
constexpr bool SHADER_ENABLED = true; // Aplica PostFX; si false, sempre passthrough.
constexpr const char* CURRENT_SHADER = "postfx"; // Shader actiu: "postfx" o "crtpi".
constexpr const char* POSTFX_DEFAULT_PRESET = "CRT"; // Preset inicial PostFX.
constexpr const char* CRTPI_DEFAULT_PRESET = "DEFAULT"; // Preset inicial CrtPi.
constexpr const char* POSTFX_FILE = "shaders/postfx.yaml"; // Relatiu a la carpeta de sistema.
constexpr const char* CRTPI_FILE = "shaders/crtpi.yaml"; // Relatiu a la carpeta de sistema.
constexpr RenderInfoPosition RENDER_INFO_POSITION = RenderInfoPosition::OFF; // Overlay de debug amagat per defecte.
constexpr bool RENDER_INFO_SHOW_TIME = true; // Si l'overlay és visible, mostra el temps de joc.
} // namespace Video
namespace Audio {
constexpr bool ENABLED = true;
constexpr float VOLUME = 1.0F;
constexpr bool MUSIC_ENABLED = true;
constexpr float MUSIC_VOLUME = 0.8F;
constexpr bool SOUND_ENABLED = true;
constexpr float SOUND_VOLUME = 1.0F;
constexpr float VOLUME_STEP = 0.05F; // Pas estàndard per a la UI (5%).
constexpr int FREQUENCY = 48000; // Freqüència de mostreig del dispositiu (Hz).
constexpr int CROSSFADE_MS = 1500; // Durada per defecte del crossfade entre pistes (ms).
constexpr SDL_AudioFormat FORMAT = SDL_AUDIO_S16; // Format PCM 16-bit signat natiu.
constexpr int CHANNELS = 2; // Nombre de canals de sortida (estèreo).
} // namespace Audio
namespace KeysGame {
constexpr SDL_Scancode UP = SDL_SCANCODE_UP;
constexpr SDL_Scancode DOWN = SDL_SCANCODE_DOWN;
constexpr SDL_Scancode LEFT = SDL_SCANCODE_LEFT;
constexpr SDL_Scancode RIGHT = SDL_SCANCODE_RIGHT;
constexpr SDL_Scancode EXIT = SDL_SCANCODE_ESCAPE;
} // namespace KeysGame
namespace Player {
constexpr float SPEED_PX_PER_S = 60.0F; // Velocitat base del jugador (sense sprint / slow-zones).
} // namespace Player
// Índexs de paleta (sega-cube.pal) i temps en ms per als components
// de UI. Centralitzats ací perquè un "tema" viu en un únic lloc: tocar
// els colors o durades de l'overlay/notificador no requereix buscar
// pel codi. Si algun dia es volen temes múltiples, es pot moure a YAML
// sense més impacte que dos accessors extra.
namespace UI {
// Fonts d'UI centralitzades: un únic lloc per conèixer la carpeta
// (data/fonts/), el nom-clau al Resource::Cache i els fitxers .gif /
// .fnt de cada font. Afegir-ne una nova és una constant ací i ja.
namespace Font {
constexpr const char* DIR = "data/fonts/";
// HUD/Notifier/RenderInfo: font principal de UI del joc.
// El kerning és la separació extra entre glifs (sumat a l'amplada
// natural). 1 és el valor clàssic; valors negatius ajunten glifs
// per a fonts de display amb sidebearings amples.
constexpr const char* HUD_NAME = "8bithud";
constexpr const char* HUD_GIF = "data/fonts/8bithud.gif";
constexpr const char* HUD_FNT = "data/fonts/8bithud.fnt";
constexpr int HUD_KERNING = 1;
// Placeholders (LOGO / TITLE / INTRO): font temporal fins que els
// placeholders es substitueixin per les seues escenes finals.
constexpr const char* PLACEHOLDER_NAME = "ari-w9500";
constexpr const char* PLACEHOLDER_GIF = "data/fonts/ari-w9500.gif";
constexpr const char* PLACEHOLDER_FNT = "data/fonts/ari-w9500.fnt";
constexpr int PLACEHOLDER_KERNING = 1;
// Menú de servei (F9): títol en display normal, items en la
// variant condensed-display (més compacta, perquè caben més
// files sense encongir la caixa). Kerning 0 a totes dues perquè
// els glifs de display ja porten sidebearings generosos.
constexpr const char* MENU_TITLE_NAME = "ari-w9500-display";
constexpr const char* MENU_TITLE_GIF = "data/fonts/ari-w9500-display.gif";
constexpr const char* MENU_TITLE_FNT = "data/fonts/ari-w9500-display.fnt";
constexpr int MENU_TITLE_KERNING = 0;
constexpr const char* MENU_ITEMS_NAME = "ari-w9500-condensed-display";
constexpr const char* MENU_ITEMS_GIF = "data/fonts/ari-w9500-condensed-display.gif";
constexpr const char* MENU_ITEMS_FNT = "data/fonts/ari-w9500-condensed-display.fnt";
constexpr int MENU_ITEMS_KERNING = 0;
} // namespace Font
// Overlay de RenderInfo (F12).
constexpr Uint8 RENDER_INFO_TEXT = 47;
constexpr Uint8 RENDER_INFO_SHADOW = 34;
// Fons del canvas (zona fora del tilemap en letterbox/integer).
constexpr Uint8 CANVAS_BG = 65;
// Preset per defecte del Notifier.
constexpr Uint8 NOTIFICATION_TEXT = 197;
constexpr Uint8 NOTIFICATION_BG = 96;
constexpr int NOTIFICATION_TIME_MS = 4000;
// Preset per a la confirmació d'eixida (ESC doble). La durada ha
// de coincidir amb la del Notifier perquè el missatge i la finestra
// de confirmació expiren alhora (veure GlobalInputs::onExit).
constexpr Uint8 EXIT_TEXT = 88;
constexpr Uint8 EXIT_BG = 40;
constexpr int EXIT_TIME_MS = 4000;
// Índexs de paleta per al menú de servei (F9).
constexpr Uint8 MENU_BG = 40; // Fons de la caixa.
constexpr Uint8 MENU_BORDER = 197; // Vora.
constexpr Uint8 MENU_TITLE = 213; // Títol i subtítol.
constexpr Uint8 MENU_LABEL = 47; // Etiquetes dels items.
constexpr Uint8 MENU_VALUE = 197; // Valor actual.
constexpr Uint8 MENU_CURSOR = 88; // Item seleccionat.
constexpr Uint8 MENU_DISABLED = 34; // Label en gris quan no aplica.
} // namespace UI
// Rutes d'assets per piràmide. Centralitzats ací perquè `GameScene` no
// en contingui cap literal; afegir una piràmide nova serà un altre
// conjunt de constants + un Config distint passat al ctor.
namespace Pyramid {
constexpr const char* MAP_YAML = "data/maps/pyramid.yaml";
constexpr const char* PLAYER_SPRITE = "data/player/player.gif";
constexpr const char* PLAYER_YAML = "data/player/player.yaml";
constexpr const char* MUSIC_TRACK = "pyramid_1.ogg";
} // namespace Pyramid
} // namespace Defaults