reorganitzada la status bar del editor

This commit is contained in:
2026-04-02 14:13:05 +02:00
parent 5f25562d52
commit acaf434e5c
3 changed files with 84 additions and 69 deletions

View File

@@ -10,7 +10,7 @@
#include "core/resources/resource_cache.hpp" // Para Resource::Cache
#include "game/options.hpp" // Para Options::game
#include "utils/defines.hpp" // Para Tile::SIZE
#include "utils/utils.hpp" // Para stringToColor
#include "utils/utils.hpp" // Para stringToColor, toLower
// Constructor
EditorStatusBar::EditorStatusBar(const std::string& room_number, const std::string& room_name)
@@ -33,21 +33,15 @@ void EditorStatusBar::update([[maybe_unused]] float delta_time) {
fillTexture();
}
// Establece las coordenadas del ratón en tiles
void EditorStatusBar::setMouseTile(int tile_x, int tile_y) {
mouse_tile_x_ = tile_x;
mouse_tile_y_ = tile_y;
}
// Establece la información de la entidad seleccionada
void EditorStatusBar::setSelectionInfo(const std::string& info) {
selection_info_ = info;
}
// Establece el detalle adicional
void EditorStatusBar::setSelectionDetail(const std::string& detail) {
selection_detail_ = detail;
}
void EditorStatusBar::setLine2(const std::string& text) { line2_ = text; }
void EditorStatusBar::setLine3(const std::string& text) { line3_ = text; }
void EditorStatusBar::setLine4(const std::string& text) { line4_ = text; }
void EditorStatusBar::setLine5(const std::string& text) { line5_ = text; }
// Dibuja los elementos en la surface
void EditorStatusBar::fillTexture() {
@@ -59,28 +53,34 @@ void EditorStatusBar::fillTexture() {
auto text = Resource::Cache::get()->getText("8bithud");
const Uint8 LABEL_COLOR = stringToColor("bright_cyan");
const Uint8 VALUE_COLOR = stringToColor("white");
const Uint8 DETAIL_COLOR = stringToColor("bright_yellow");
// Línea 1: Número y nombre de la habitación
const std::string ROOM_TEXT = toLower(room_number_ + " " + room_name_);
text->writeColored(LEFT_X, LINE1_Y, ROOM_TEXT, LABEL_COLOR);
// Línea 1: Nombre de la habitación
text->writeColored(LEFT_X, LINE1_Y, toLower(room_number_ + " " + room_name_), LABEL_COLOR);
// Línea 2: Coordenadas del ratón en tiles
// Línea 2: Propiedades de room o info de enemigo
if (!line2_.empty()) {
text->writeColored(LEFT_X, LINE2_Y, toLower(line2_), DETAIL_COLOR);
}
// Línea 3: Conexiones+items o propiedades del enemigo
if (!line3_.empty()) {
text->writeColored(LEFT_X, LINE3_Y, toLower(line3_), VALUE_COLOR);
}
// Línea 4: Extra
if (!line4_.empty()) {
text->writeColored(LEFT_X, LINE4_Y, toLower(line4_), DETAIL_COLOR);
}
// Línea 5: Tile coords + drag info
const std::string TILE_X_STR = (mouse_tile_x_ < 10 ? "0" : "") + std::to_string(mouse_tile_x_);
const std::string TILE_Y_STR = (mouse_tile_y_ < 10 ? "0" : "") + std::to_string(mouse_tile_y_);
text->writeColored(LEFT_X, LINE2_Y, toLower("tile:"), LABEL_COLOR);
text->writeColored(LEFT_X + 30, LINE2_Y, TILE_X_STR + "," + TILE_Y_STR, VALUE_COLOR);
// Línea 2 (continuación): info de selección o indicador de modo editor
if (!selection_info_.empty()) {
text->writeColored(LEFT_X + 60, LINE2_Y, toLower(selection_info_), stringToColor("bright_yellow"));
} else {
text->writeColored(176, LINE2_Y, toLower("editor"), stringToColor("bright_green"));
}
// Línea 3: detalle de la selección (propiedades del enemigo)
if (!selection_detail_.empty()) {
text->writeColored(LEFT_X, LINE3_Y, toLower(selection_detail_), stringToColor("bright_white"));
std::string line5 = "tile:" + TILE_X_STR + "," + TILE_Y_STR;
if (!line5_.empty()) {
line5 += " " + line5_;
}
text->writeColored(LEFT_X, LINE5_Y, toLower(line5), stringToColor("bright_green"));
Screen::get()->setRendererSurface(previous_renderer);
}