Fase 8a+b: paleta semantica de color por entidad

Cada entity declara su color de linea via parametro opcional. Cuando
alpha==0 el pipeline cae al color global del oscilador (compatibilidad
con el comportamiento anterior).

Defaults::Palette (defaults.hpp):
- SHIP        = blanco neutro
- BULLET      = verde laser
- PENTAGON    = azul "esquivador"
- QUADRAT     = rojo "tank"
- MOLINILLO   = magenta agresivo

Pipeline:
- linea(): parametro SDL_Color color (default {0,0,0,0}). En .cpp,
  fuente del color = color.a>0 ? color : g_current_line_color.
- render_shape(): parametro SDL_Color color que propaga a cada linea
  del shape.
- Debris: campo color en la struct; explode() recibe SDL_Color color
  y lo guarda en cada fragment; draw() lo pasa a linea().

Aplicacion:
- Ship::draw -> Palette::SHIP.
- Bullet::draw -> Palette::BULLET.
- Enemy::draw -> Palette::{PENTAGON,QUADRAT,MOLINILLO} segun type_.
- CollisionSystem detectBulletEnemy: debris hereda color del enemy.
- GameScene::tocado: debris hereda Palette::SHIP.

Smoke test xvfb OK.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-20 08:04:56 +02:00
parent 5c9f6e6613
commit 6d7060ceb5
13 changed files with 73 additions and 41 deletions
+11
View File
@@ -107,6 +107,17 @@ constexpr float ENEMY_RADIUS = 20.0F;
constexpr float BULLET_RADIUS = 3.0F;
} // namespace Entities
// Paleta semántica por tipo de entidad. Si una entity declara color, lo
// pasa al pipeline con alpha=255 (sentinela "color válido"); si no, se
// usa el color global del oscilador (g_current_line_color).
namespace Palette {
constexpr SDL_Color SHIP = {.r = 255, .g = 255, .b = 255, .a = 255}; // Blanco neutro
constexpr SDL_Color BULLET = {.r = 120, .g = 255, .b = 140, .a = 255}; // Verde laser
constexpr SDL_Color PENTAGON = {.r = 120, .g = 170, .b = 255, .a = 255}; // Azul "esquivador"
constexpr SDL_Color QUADRAT = {.r = 255, .g = 110, .b = 110, .a = 255}; // Rojo "tank"
constexpr SDL_Color MOLINILLO = {.r = 255, .g = 130, .b = 255, .a = 255}; // Magenta agresivo
} // namespace Palette
// Ship (nave del player)
namespace Ship {
// Invulnerabilidad post-respawn