mes retocs a minimap. arreglat el calcul dels minipixels en els tiles amb transparent

This commit is contained in:
2026-04-02 19:49:43 +02:00
parent b5e822c65f
commit cccb2359cf
4 changed files with 160 additions and 38 deletions

View File

@@ -15,6 +15,7 @@
#include "core/resources/resource_cache.hpp" // Para Resource::Cache
#include "core/resources/resource_list.hpp" // Para Resource::List
#include "game/editor/editor_statusbar.hpp" // Para EditorStatusBar
#include "game/game_control.hpp" // Para GameControl
#include "game/editor/room_saver.hpp" // Para RoomSaver
#include "game/entities/player.hpp" // Para Player
#include "game/gameplay/enemy_manager.hpp" // Para EnemyManager
@@ -119,8 +120,19 @@ static auto parseColor(const std::string& value) -> Uint8 {
void MapEditor::toggleMiniMap() {
if (!mini_map_) {
mini_map_ = std::make_unique<MiniMap>(parseColor(settings_.minimap_bg), parseColor(settings_.minimap_conn));
mini_map_->on_navigate = [this](const std::string& room_name) {
mini_map_visible_ = false;
// Navegar a la room (usa changeRoomWithEditor vía GameControl)
if (GameControl::exit_editor) { GameControl::exit_editor(); }
if (GameControl::change_room && GameControl::change_room(room_name)) {
if (GameControl::enter_editor) { GameControl::enter_editor(); }
}
};
}
mini_map_visible_ = !mini_map_visible_;
if (mini_map_visible_) {
mini_map_->centerOnRoom(room_path_);
}
}
auto MapEditor::setMiniMapBg(const std::string& color) -> std::string {
@@ -347,18 +359,16 @@ void MapEditor::handleEvent(const SDL_Event& event) {
return;
}
// Si el mini mapa está visible, cerrarlo con click o ESC
if (mini_map_visible_) {
if (event.type == SDL_EVENT_MOUSE_BUTTON_DOWN ||
(event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_ESCAPE)) {
// Si el mini mapa está visible, delegar eventos (ESC o M para cerrar)
if (mini_map_visible_ && mini_map_) {
if (event.type == SDL_EVENT_KEY_DOWN &&
(event.key.key == SDLK_ESCAPE || event.key.key == SDLK_M) &&
static_cast<int>(event.key.repeat) == 0) {
mini_map_visible_ = false;
return;
}
if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_M) {
mini_map_visible_ = false;
return;
}
return; // Bloquear otros eventos mientras el minimapa está visible
mini_map_->handleEvent(event, room_path_);
return;
}
// ESC: desactivar brush