optimitzacions en Surface

This commit is contained in:
2026-04-18 12:40:13 +02:00
parent f5b6bc3ef9
commit 412df1316f
6 changed files with 105 additions and 167 deletions

View File

@@ -384,7 +384,11 @@ void MiniMap::handleEvent(const SDL_Event& event, const std::string& current_roo
Screen::get()->setRendererSurface(prev);
}
auto game_surface = Screen::get()->getRendererSurface();
if (game_surface) { map_surface_->setPalette(game_surface->getPalette()); }
if (game_surface) {
Palette src_palette{};
for (int i = 0; i < 256; ++i) { src_palette[i] = game_surface->getPaletteColor(static_cast<Uint8>(i)); }
map_surface_->setPalette(src_palette);
}
std::string file = Screenshot::save(*map_surface_);
if (!file.empty()) { std::cout << "MiniMap screenshot: " << file << "\n"; }
// Recomponer para limpiar los números de la surface

View File

@@ -256,7 +256,7 @@ void Notifier::show(std::vector<std::string> texts, const Style& style, int icon
else if (SHAPE == Shape::SQUARED) {
n.surface->clear(style.bg_color);
SDL_FRect squared_rect = {.x = 0, .y = 0, .w = n.surface->getWidth(), .h = n.surface->getHeight()};
SDL_FRect squared_rect = {.x = 0, .y = 0, .w = static_cast<float>(n.surface->getWidth()), .h = static_cast<float>(n.surface->getHeight())};
n.surface->drawRectBorder(&squared_rect, style.border_color);
}