key_config.cpp i keys.yaml per a centralitzar i no hardcodejar tecles
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "core/audio/audio.hpp" // Para Audio
|
||||
#include "core/input/input.hpp" // Para Input, InputAction
|
||||
#include "core/input/key_config.hpp" // Para KeyConfig
|
||||
#include "core/locale/locale.hpp" // Para Locale
|
||||
#include "core/rendering/render_info.hpp" // Para RenderInfo
|
||||
#include "core/rendering/screen.hpp" // Para Screen
|
||||
@@ -186,6 +187,9 @@ Director::Director() {
|
||||
Console::init("8bithud");
|
||||
Screen::get()->setNotificationsEnabled(true);
|
||||
|
||||
// Cargar configuración de teclas desde YAML (fuente única de verdad)
|
||||
KeyConfig::init("data/input/keys.yaml");
|
||||
|
||||
// Special handling for gamecontrollerdb.txt - SDL needs filesystem path
|
||||
#ifdef RELEASE_BUILD
|
||||
// In release, construct the path manually (not from Asset which has empty executable_path)
|
||||
@@ -196,6 +200,9 @@ Director::Director() {
|
||||
Input::init(Resource::List::get()->get("gamecontrollerdb.txt")); // Carga configuración de controles
|
||||
#endif
|
||||
|
||||
// Aplicar teclas globales desde KeyConfig al sistema de Input
|
||||
KeyConfig::get()->applyGlobalBindings();
|
||||
|
||||
// Aplica las teclas y botones del gamepad configurados desde Options
|
||||
Input::get()->applyKeyboardBindingsFromOptions();
|
||||
Input::get()->applyGamepadBindingsFromOptions();
|
||||
@@ -246,6 +253,7 @@ Director::~Director() {
|
||||
Debug::destroy();
|
||||
#endif
|
||||
Input::destroy();
|
||||
KeyConfig::destroy();
|
||||
Console::destroy();
|
||||
RenderInfo::destroy();
|
||||
Notifier::destroy();
|
||||
|
||||
Reference in New Issue
Block a user