la consola ja no pausa al jugador

This commit is contained in:
2026-03-29 18:24:47 +02:00
parent 3b233f0e12
commit 301e0145fb
5 changed files with 21 additions and 12 deletions

View File

@@ -907,6 +907,7 @@ void Console::toggle() {
cursor_visible_ = true;
SDL_StartTextInput(SDL_GetKeyboardFocus());
if (Notifier::get() != nullptr) { Notifier::get()->addYOffset(static_cast<int>(height_)); }
if (on_toggle) { on_toggle(true); }
break;
case Status::ACTIVE:
status_ = Status::VANISHING;
@@ -915,6 +916,7 @@ void Console::toggle() {
saved_input_.clear();
SDL_StopTextInput(SDL_GetKeyboardFocus());
if (Notifier::get() != nullptr) { Notifier::get()->removeYOffset(static_cast<int>(height_)); }
if (on_toggle) { on_toggle(false); }
break;
default:
// Durante RISING o VANISHING no se hace nada

View File

@@ -2,9 +2,10 @@
#include <SDL3/SDL.h>
#include <deque> // Para deque (historial)
#include <memory> // Para shared_ptr
#include <string> // Para string
#include <deque> // Para deque (historial)
#include <functional> // Para function
#include <memory> // Para shared_ptr
#include <string> // Para string
class Surface;
class Sprite;
@@ -28,6 +29,9 @@ class Console {
auto getVisibleHeight() -> int; // Píxeles visibles actuales (0 = oculta, height_ = totalmente visible)
[[nodiscard]] auto getText() const -> std::shared_ptr<Text> { return text_; }
// Callback llamado al abrir (true) o cerrar (false) la consola
std::function<void(bool)> on_toggle;
private:
enum class Status {
HIDDEN,