// zones.hpp - Zones de l'àrea de joc (SDL_FRect amb càlculs automàtics per percentatges) // © 2026 JailDesigner #pragma once #include #include "core/defaults/game.hpp" namespace Defaults::Zones { // --- CONFIGURACIÓ DE PORCENTATGES --- // Todas las zones definides como a porcentajes de Game::WIDTH (640) i Game::HEIGHT (480) // Percentatges de height (divisió vertical) constexpr float SCOREBOARD_TOP_HEIGHT_PERCENT = 0.02F; // 10% superior constexpr float MAIN_PLAYAREA_HEIGHT_PERCENT = 0.88F; // 80% central constexpr float SCOREBOARD_BOTTOM_HEIGHT_PERCENT = 0.10F; // 10% inferior // Padding horizontal para PLAYAREA (dentro de MAIN_PLAYAREA) constexpr float PLAYAREA_PADDING_HORIZONTAL_PERCENT = 0.015F; // 5% a cada costat // --- CÀLCULS AUTOMÀTICS DE PÍXELS --- // Cálculos automáticos a partir dels porcentajes // Alçades constexpr float SCOREBOARD_TOP_H = Game::HEIGHT * SCOREBOARD_TOP_HEIGHT_PERCENT; constexpr float MAIN_PLAYAREA_H = Game::HEIGHT * MAIN_PLAYAREA_HEIGHT_PERCENT; constexpr float SCOREBOARD_BOTTOM_H = Game::HEIGHT * SCOREBOARD_BOTTOM_HEIGHT_PERCENT; // Posicions Y constexpr float SCOREBOARD_TOP_Y = 0.0F; constexpr float MAIN_PLAYAREA_Y = SCOREBOARD_TOP_H; constexpr float SCOREBOARD_BOTTOM_Y = MAIN_PLAYAREA_Y + MAIN_PLAYAREA_H; // Padding horizontal de PLAYAREA constexpr float PLAYAREA_PADDING_H = Game::WIDTH * PLAYAREA_PADDING_HORIZONTAL_PERCENT; // --- ZONES FINALS (SDL_FRect) --- // Marcador superior (reservado para futuro uso) // Ocupa el 2% superior constexpr SDL_FRect SCOREBOARD_TOP = { 0.0F, // x = 0.0 SCOREBOARD_TOP_Y, // y = 0.0 static_cast(Game::WIDTH), // ancho completo SCOREBOARD_TOP_H // alto }; // Área de juego principal (contenedor del 80% central, sin padding) // Ocupa el 88% central, ancho completo constexpr SDL_FRect MAIN_PLAYAREA = { 0.0F, // x = 0.0 MAIN_PLAYAREA_Y, // debajo del scoreboard superior static_cast(Game::WIDTH), // ancho completo MAIN_PLAYAREA_H // alto }; // Zona de juego real (con padding horizontal del 5%) // Ocupa: dentro de MAIN_PLAYAREA, con márgenes laterales // Se utiliza para límites del juego, colisiones, spawn constexpr SDL_FRect PLAYAREA = { PLAYAREA_PADDING_H, // padding horizontal MAIN_PLAYAREA_Y, // debajo del scoreboard superior (igual que MAIN_PLAYAREA) Game::WIDTH - (2.0F * PLAYAREA_PADDING_H), // ancho con padding MAIN_PLAYAREA_H // alto (igual que MAIN_PLAYAREA) }; // Marcador inferior (marcador actual) // Ocupa el 10% inferior constexpr SDL_FRect SCOREBOARD = { 0.0F, // x = 0.0 SCOREBOARD_BOTTOM_Y, // fondo static_cast(Game::WIDTH), // ancho completo SCOREBOARD_BOTTOM_H // alto }; // Padding horizontal del marcador (para alinear zonas izquierda/derecha con PLAYAREA) constexpr float SCOREBOARD_PADDING_H = 0.0F; // Game::WIDTH * 0.015f; } // namespace Defaults::Zones