Refactor input handling in Emulator and Controller for improved key event management

This commit is contained in:
scawful
2024-11-18 14:34:08 -05:00
parent b38dc078fe
commit 36e5f7a150
3 changed files with 128 additions and 118 deletions

View File

@@ -19,6 +19,21 @@ namespace app {
*/
namespace emu {
struct EmulatorKeybindings {
ImGuiKey a_button = ImGuiKey_Z;
ImGuiKey b_button = ImGuiKey_A;
ImGuiKey x_button = ImGuiKey_S;
ImGuiKey y_button = ImGuiKey_X;
ImGuiKey l_button = ImGuiKey_Q;
ImGuiKey r_button = ImGuiKey_W;
ImGuiKey start_button = ImGuiKey_RETURN;
ImGuiKey select_button = ImGuiKey_BACKSPACE;
ImGuiKey up_button = ImGuiKey_UP;
ImGuiKey down_button = ImGuiKey_DOWN;
ImGuiKey left_button = ImGuiKey_LEFT;
ImGuiKey right_button = ImGuiKey_RIGHT;
};
/**
* @class Emulator
* @brief A class for emulating and debugging SNES games.
@@ -145,6 +160,8 @@ class Emulator : public SharedRom {
std::vector<uint8_t> rom_data_;
EmulatorKeybindings keybindings_;
gui::zeml::Node emulator_node_;
};