tweak(playfield): rejilla violeta synthwave + brillos +5%; starfield unificat al color del títol

This commit is contained in:
2026-05-22 23:10:06 +02:00
parent b1ee23cd20
commit e954d4ea59
3 changed files with 19 additions and 13 deletions
+7 -2
View File
@@ -3,6 +3,8 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
namespace Defaults::Playfield { namespace Defaults::Playfield {
// Estructura de la graella (cel·les omplen tota la PLAYAREA) // Estructura de la graella (cel·les omplen tota la PLAYAREA)
@@ -11,8 +13,11 @@ namespace Defaults::Playfield {
constexpr int SUBDIVISIONS = 4; // cada cel·la principal es divideix en N subcel·les constexpr int SUBDIVISIONS = 4; // cada cel·la principal es divideix en N subcel·les
// Brillo respecte al color global (border = 1.0) // Brillo respecte al color global (border = 1.0)
constexpr float GRID_BRIGHTNESS = 0.15F; constexpr float GRID_BRIGHTNESS = 0.20F;
constexpr float SUBGRID_BRIGHTNESS = 0.05F; constexpr float SUBGRID_BRIGHTNESS = 0.10F;
// Color de la rejilla (lila/violeta synthwave). Es modula amb brillantor.
constexpr SDL_Color GRID_COLOR = {.r = 160, .g = 80, .b = 255, .a = 255};
// Animació de creació amb timer intern del Playfield. // Animació de creació amb timer intern del Playfield.
// L'animació total cobreix tot l'INIT_HUD (3 s). Cada línia es pinta en // L'animació total cobreix tot l'INIT_HUD (3 s). Cada línia es pinta en
+9 -3
View File
@@ -290,7 +290,9 @@ namespace Graphics {
static_cast<int>(START_Y), static_cast<int>(START_Y),
static_cast<int>(END_X), static_cast<int>(END_X),
static_cast<int>(END_Y), static_cast<int>(END_Y),
line.brightness); line.brightness,
0.0F,
Defaults::Playfield::GRID_COLOR);
// Cap brillant mentre creix. // Cap brillant mentre creix.
if (P < 1.0F) { if (P < 1.0F) {
const float LENGTH = std::sqrt((DX * DX) + (DY * DY)); const float LENGTH = std::sqrt((DX * DX) + (DY * DY));
@@ -302,7 +304,9 @@ namespace Graphics {
static_cast<int>(START_Y + (DY * HEAD_T)), static_cast<int>(START_Y + (DY * HEAD_T)),
static_cast<int>(END_X), static_cast<int>(END_X),
static_cast<int>(END_Y), static_cast<int>(END_Y),
Defaults::Playfield::HEAD_BRIGHTNESS); Defaults::Playfield::HEAD_BRIGHTNESS,
0.0F,
Defaults::Playfield::GRID_COLOR);
} }
} }
return; return;
@@ -329,7 +333,9 @@ namespace Graphics {
static_cast<int>(prev_y), static_cast<int>(prev_y),
static_cast<int>(NX), static_cast<int>(NX),
static_cast<int>(NY), static_cast<int>(NY),
line.brightness); line.brightness,
0.0F,
Defaults::Playfield::GRID_COLOR);
prev_x = NX; prev_x = NX;
prev_y = NY; prev_y = NY;
} }
+3 -8
View File
@@ -31,20 +31,15 @@ namespace Graphics {
const float MIN_Y = zona.y; const float MIN_Y = zona.y;
const float MAX_Y = zona.y + zona.h; const float MAX_Y = zona.y + zona.h;
// Tint aleatori entre blanc (255,255,255) i cyan (0,255,255) per estrella. // Color únic per a totes les estrelles: el mateix blanc-blau gel
// T ∈ [0,1]: 0 → blanc; 1 → cyan. R = 255·(1-T), G=B=255. // del starfield del títol (Defaults::Title::Colors::STARFIELD).
const auto FILL_LAYER = [&](int layer, int count, int& idx) { const auto FILL_LAYER = [&](int layer, int count, int& idx) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
const float T = randUniform(0.0F, 1.0F);
stars_[idx++] = Star{ stars_[idx++] = Star{
.x = randUniform(MIN_X, MAX_X), .x = randUniform(MIN_X, MAX_X),
.y = randUniform(MIN_Y, MAX_Y), .y = randUniform(MIN_Y, MAX_Y),
.layer = layer, .layer = layer,
.color = SDL_Color{ .color = Defaults::Title::Colors::STARFIELD};
.r = static_cast<Uint8>(255.0F * (1.0F - T)),
.g = 255,
.b = 255,
.a = 255}};
} }
}; };