Implementing WindowsScancodes

This commit is contained in:
2024-01-05 13:02:30 -05:00
parent 10a8105f71
commit 6f8fbf18bd

View File

@@ -21,8 +21,6 @@ public:
WindowsScancode winScanCode;
};
namespace Keys {
static const Key Escape {'\b', X11Scancode::ESCAPE, WindowsScancode::ESCAPE};
static const Key F1 {'\u000f', X11Scancode::F1, WindowsScancode::F1};
@@ -120,14 +118,21 @@ namespace MouseButtons
static const MouseButton Middle;
static const MouseButton Side1;
static const MouseButton Side2;
}
static Key GetKeyFromX11Scancode(X11Scancode code)
{
for (auto& key : Key::GetKeyboard()) {
if (key.x11ScanCode == code)
return key;
}
}
throw "Unavaliable Scancode: " + std::to_string((int)code);
}
static Key GetKeyFromWindowsScancode(WindowsScancode code)
{
for (auto& key : Key::GetKeyboard()) {
if (key.winScanCode == code)
return key;
}
throw "Unavaliable Scancode: " + std::to_string((int)code);
}