fix: editor encara posava border en el yaml

new: en el editor pots mouret d'habitació amb cursors
This commit is contained in:
2026-04-07 21:05:29 +02:00
parent da5d880626
commit 3f41c1149f
3 changed files with 24 additions and 3 deletions

View File

@@ -1,6 +1,5 @@
room:
bgColor: 0
border: 0
tileSetFile: standard.gif
# Conexiones de la habitación (null = sin conexión)

View File

@@ -1,6 +1,5 @@
room:
bgColor: 34
border: 0
tileSetFile: standard.gif
# Conexiones de la habitación (null = sin conexión)

View File

@@ -461,6 +461,30 @@ void MapEditor::handleEvent(const SDL_Event& event) { // NOLINT(readability-fun
return;
}
// Cursores: navegar a habitación adyacente
if (event.type == SDL_EVENT_KEY_DOWN && static_cast<int>(event.key.repeat) == 0) {
std::string direction;
switch (event.key.key) {
case SDLK_UP: direction = "UP"; break;
case SDLK_DOWN: direction = "DOWN"; break;
case SDLK_LEFT: direction = "LEFT"; break;
case SDLK_RIGHT: direction = "RIGHT"; break;
default: break;
}
if (!direction.empty() && GameControl::get_adjacent_room) {
std::string adjacent = GameControl::get_adjacent_room(direction);
if (!adjacent.empty() && adjacent != "0") {
autosave();
reenter_ = true;
if (GameControl::exit_editor) { GameControl::exit_editor(); }
if (GameControl::change_room && GameControl::change_room(adjacent)) {
if (GameControl::enter_editor) { GameControl::enter_editor(); }
}
return;
}
}
}
// Click derecho: abrir TilePicker
if (event.type == SDL_EVENT_MOUSE_BUTTON_DOWN && event.button.button == SDL_BUTTON_RIGHT) {
// Deseleccionar entidades
@@ -1407,7 +1431,6 @@ auto MapEditor::createNewRoom(const std::string& direction) -> std::string { //
file << " name_en: \"NO_NAME\"\n";
file << " name_ca: \"NO_NAME\"\n";
file << " bgColor: black\n";
file << " border: magenta\n";
file << " tileSetFile: standard.gif\n";
file << "\n";
file << " connections:\n";