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:
1 parent
5c9f6e6613
commit
6d7060ceb5
13 files changed
+73
-41
No files matched your search
@@ -137,6 +137,7 @@ void Bullet::desactivar() {
|
||||
void Bullet::draw() const {
|
||||
if (esta_ && shape_) {
|
||||
// Les bales roten segons l'angle de trayectòria (estático tras disparo)
|
||||
Rendering::render_shape(renderer_, shape_, center_, angle_, 1.0F, 1.0F, brightness_);
|
||||
Rendering::render_shape(renderer_, shape_, center_, angle_, 1.0F, 1.0F, brightness_,
|
||||
/*rotation_3d=*/nullptr, Defaults::Palette::BULLET);
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,14 @@ void Enemy::draw() const {
|
||||
return;
|
||||
}
|
||||
const float SCALE = computeCurrentScale();
|
||||
Rendering::render_shape(renderer_, shape_, center_, rotacio_, SCALE, 1.0F, brightness_);
|
||||
SDL_Color color{};
|
||||
switch (type_) {
|
||||
case EnemyType::PENTAGON: color = Defaults::Palette::PENTAGON; break;
|
||||
case EnemyType::QUADRAT: color = Defaults::Palette::QUADRAT; break;
|
||||
case EnemyType::MOLINILLO: color = Defaults::Palette::MOLINILLO; break;
|
||||
}
|
||||
Rendering::render_shape(renderer_, shape_, center_, rotacio_, SCALE, 1.0F, brightness_,
|
||||
/*rotation_3d=*/nullptr, color);
|
||||
}
|
||||
|
||||
void Enemy::destruir() {
|
||||
|
||||
@@ -160,5 +160,6 @@ void Ship::draw() const {
|
||||
const float VISUAL_PUSH = SPEED / 33.33F;
|
||||
const float SCALE = 1.0F + (VISUAL_PUSH / 12.0F);
|
||||
|
||||
Rendering::render_shape(renderer_, shape_, center_, angle_, SCALE, 1.0F, brightness_);
|
||||
Rendering::render_shape(renderer_, shape_, center_, angle_, SCALE, 1.0F, brightness_,
|
||||
/*rotation_3d=*/nullptr, Defaults::Palette::SHIP);
|
||||
}
|
||||
Reference in new issue
Block a user