tecla 9 per entrar i eixir del editor

This commit is contained in:
2026-04-02 11:25:03 +02:00
parent 20bac58814
commit dccd0d41e4
4 changed files with 20 additions and 7 deletions

View File

@@ -168,7 +168,16 @@ void Game::handleEvents() {
GlobalEvents::handle(event);
#ifdef _DEBUG
if (!Console::get()->isActive()) {
if (MapEditor::get()->isActive()) {
// Tecla 9: toggle editor (funciona tanto dentro como fuera del editor)
if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_9 && static_cast<int>(event.key.repeat) == 0) {
if (MapEditor::get()->isActive()) {
GameControl::exit_editor();
Notifier::get()->show({Locale::get()->get("game.editor_disabled")}); // NOLINT(readability-static-accessed-through-instance)
} else {
GameControl::enter_editor();
Notifier::get()->show({Locale::get()->get("game.editor_enabled")}); // NOLINT(readability-static-accessed-through-instance)
}
} else if (MapEditor::get()->isActive()) {
MapEditor::get()->handleEvent(event);
} else {
handleDebugEvents(event);