llevat soport per a colors amb nom

This commit is contained in:
2026-04-06 09:14:36 +02:00
parent c4a26ffa0f
commit cdf0665458
121 changed files with 676 additions and 5754 deletions

View File

@@ -8,7 +8,7 @@
#include "core/rendering/surface.hpp" // Para Surface
#include "core/resources/resource_cache.hpp" // Para Resource::Cache
#include "utils/defines.hpp" // Para Tile::SIZE, PlayArea
#include "utils/utils.hpp" // Para stringToColor
#include "utils/utils.hpp"
// Margen del borde alrededor del tileset (en pixels)
static constexpr int BORDER_PAD = 3;
@@ -51,14 +51,14 @@ void TilePicker::open(const std::string& tileset_name, int current_tile, int bg_
auto prev = Screen::get()->getRendererSurface();
Screen::get()->setRendererSurface(frame_surface_);
Uint8 fill_color = (bg_color >= 0) ? static_cast<Uint8>(bg_color) : stringToColor("black");
Uint8 fill_color = (bg_color >= 0) ? static_cast<Uint8>(bg_color) : 0;
frame_surface_->clear(fill_color);
// Borde doble
SDL_FRect outer = {.x = 0, .y = 0, .w = static_cast<float>(frame_w), .h = static_cast<float>(frame_h)};
frame_surface_->drawRectBorder(&outer, stringToColor("bright_white"));
frame_surface_->drawRectBorder(&outer, 15);
SDL_FRect inner = {.x = 1, .y = 1, .w = static_cast<float>(frame_w - 2), .h = static_cast<float>(frame_h - 2)};
frame_surface_->drawRectBorder(&inner, stringToColor("white"));
frame_surface_->drawRectBorder(&inner, 14);
// Renderizar cada tile individualmente
constexpr auto TS = static_cast<float>(Tile::SIZE);
@@ -153,7 +153,7 @@ void TilePicker::render() {
float hy = tileset_screen_y + static_cast<float>(row * out_cell);
if (hy >= 0 && hy + TS <= visible_height_) {
SDL_FRect highlight = {.x = hx, .y = hy, .w = TS, .h = TS};
game_surface->drawRectBorder(&highlight, stringToColor("bright_white"));
game_surface->drawRectBorder(&highlight, 15);
}
}
@@ -165,7 +165,7 @@ void TilePicker::render() {
float cy = tileset_screen_y + static_cast<float>(row * out_cell);
if (cy >= 0 && cy + TS <= visible_height_) {
SDL_FRect cur_rect = {.x = cx, .y = cy, .w = TS, .h = TS};
game_surface->drawRectBorder(&cur_rect, stringToColor("bright_green"));
game_surface->drawRectBorder(&cur_rect, 9);
}
}
}