eliminat el path de borde multicolor
This commit is contained in:
@@ -90,10 +90,8 @@ Screen::Screen() {
|
|||||||
border_surface_,
|
border_surface_,
|
||||||
[this]() {
|
[this]() {
|
||||||
// Actualizar caché ARGB del borde cuando cambia la paleta
|
// Actualizar caché ARGB del borde cuando cambia la paleta
|
||||||
if (border_is_solid_) {
|
border_surface_->toARGBBuffer(border_pixel_buffer_.data());
|
||||||
border_surface_->toARGBBuffer(border_pixel_buffer_.data());
|
border_argb_color_ = border_pixel_buffer_[0];
|
||||||
border_argb_color_ = border_pixel_buffer_[0];
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Cachear el color ARGB inicial del borde (borde sólido por defecto)
|
// Cachear el color ARGB inicial del borde (borde sólido por defecto)
|
||||||
@@ -221,7 +219,6 @@ void Screen::setBorderColor(Uint8 color) {
|
|||||||
// Actualizar caché ARGB del borde sólido (ocurre una vez por habitación, no cada frame)
|
// Actualizar caché ARGB del borde sólido (ocurre una vez por habitación, no cada frame)
|
||||||
border_surface_->toARGBBuffer(border_pixel_buffer_.data());
|
border_surface_->toARGBBuffer(border_pixel_buffer_.data());
|
||||||
border_argb_color_ = border_pixel_buffer_[0];
|
border_argb_color_ = border_pixel_buffer_[0];
|
||||||
border_is_solid_ = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cambia entre borde visible y no visible
|
// Cambia entre borde visible y no visible
|
||||||
@@ -397,27 +394,20 @@ void Screen::textureToRenderer() {
|
|||||||
const int OFF_X = static_cast<int>(game_surface_dstrect_.x);
|
const int OFF_X = static_cast<int>(game_surface_dstrect_.x);
|
||||||
const int OFF_Y = static_cast<int>(game_surface_dstrect_.y);
|
const int OFF_Y = static_cast<int>(game_surface_dstrect_.y);
|
||||||
|
|
||||||
if (border_is_solid_) {
|
// Rellena solo el marco con el color cacheado — sin lookups de paleta.
|
||||||
// Path A: borde sólido (gameplay normal)
|
// El área central (juego) se deja sin tocar; el overlay la sobreescribe igualmente.
|
||||||
// Rellena solo el marco con el color cacheado — sin lookups de paleta.
|
|
||||||
// El área central (juego) se deja sin tocar; el overlay la sobreescribe igualmente.
|
|
||||||
|
|
||||||
// Franjas superior e inferior (ancho completo)
|
// Franjas superior e inferior (ancho completo)
|
||||||
std::fill_n(border_pixel_buffer_.data(), OFF_Y * BORDER_W, border_argb_color_);
|
std::fill_n(border_pixel_buffer_.data(), OFF_Y * BORDER_W, border_argb_color_);
|
||||||
std::fill_n(&border_pixel_buffer_[(OFF_Y + GAME_H) * BORDER_W],
|
std::fill_n(&border_pixel_buffer_[(OFF_Y + GAME_H) * BORDER_W],
|
||||||
(BORDER_H - OFF_Y - GAME_H) * BORDER_W,
|
(BORDER_H - OFF_Y - GAME_H) * BORDER_W,
|
||||||
|
border_argb_color_);
|
||||||
|
// Columnas laterales en las filas del área de juego
|
||||||
|
for (int y = OFF_Y; y < OFF_Y + GAME_H; ++y) {
|
||||||
|
std::fill_n(&border_pixel_buffer_[y * BORDER_W], OFF_X, border_argb_color_);
|
||||||
|
std::fill_n(&border_pixel_buffer_[(y * BORDER_W) + OFF_X + GAME_W],
|
||||||
|
BORDER_W - OFF_X - GAME_W,
|
||||||
border_argb_color_);
|
border_argb_color_);
|
||||||
// Columnas laterales en las filas del área de juego
|
|
||||||
for (int y = OFF_Y; y < OFF_Y + GAME_H; ++y) {
|
|
||||||
std::fill_n(&border_pixel_buffer_[y * BORDER_W], OFF_X, border_argb_color_);
|
|
||||||
std::fill_n(&border_pixel_buffer_[(y * BORDER_W) + OFF_X + GAME_W],
|
|
||||||
BORDER_W - OFF_X - GAME_W,
|
|
||||||
border_argb_color_);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Path B: borde dinámico (escena de carga — bandas de colores animadas)
|
|
||||||
// Conversión completa: la escena modifica border_surface_ cada frame
|
|
||||||
border_surface_->toARGBBuffer(border_pixel_buffer_.data());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overlay del juego sobre el centro del buffer (ambos paths)
|
// Overlay del juego sobre el centro del buffer (ambos paths)
|
||||||
@@ -508,7 +498,6 @@ auto Screen::getRenderer() -> SDL_Renderer* { return renderer_; }
|
|||||||
auto Screen::getRendererSurface() -> std::shared_ptr<Surface> { return (*renderer_surface_); }
|
auto Screen::getRendererSurface() -> std::shared_ptr<Surface> { return (*renderer_surface_); }
|
||||||
auto Screen::getGameSurface() -> std::shared_ptr<Surface> { return game_surface_; }
|
auto Screen::getGameSurface() -> std::shared_ptr<Surface> { return game_surface_; }
|
||||||
auto Screen::getBorderSurface() -> std::shared_ptr<Surface> {
|
auto Screen::getBorderSurface() -> std::shared_ptr<Surface> {
|
||||||
border_is_solid_ = false; // Modificación externa → modo borde dinámico
|
|
||||||
return border_surface_;
|
return border_surface_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -164,9 +164,7 @@ class Screen {
|
|||||||
std::vector<Uint32> game_pixel_buffer_; // Textura de juego
|
std::vector<Uint32> game_pixel_buffer_; // Textura de juego
|
||||||
std::vector<Uint32> border_pixel_buffer_; // Textura de borde (composición final borde+juego)
|
std::vector<Uint32> border_pixel_buffer_; // Textura de borde (composición final borde+juego)
|
||||||
|
|
||||||
// Caché del borde sólido (gameplay normal)
|
Uint32 border_argb_color_{0}; // Color ARGB pre-convertido del borde
|
||||||
bool border_is_solid_{true}; // true = borde de color sólido; false = borde dinámico (carga)
|
|
||||||
Uint32 border_argb_color_{0}; // Color ARGB pre-convertido del borde sólido
|
|
||||||
|
|
||||||
// Configuración de ventana y pantalla
|
// Configuración de ventana y pantalla
|
||||||
int window_width_{0}; // Ancho de la pantalla o ventana
|
int window_width_{0}; // Ancho de la pantalla o ventana
|
||||||
|
|||||||
Reference in New Issue
Block a user