mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-05-06 12:14:49 +12:00
Configurable keyboard mappings
This commit is contained in:
parent
27ad7b01f3
commit
e576e64736
9 changed files with 162 additions and 125 deletions
23
include/mappings.hpp
Normal file
23
include/mappings.hpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "helpers.hpp"
|
||||
#include "services/hid.hpp"
|
||||
|
||||
struct InputMappings {
|
||||
using Scancode = u32;
|
||||
using Container = std::unordered_map<Scancode, u32>;
|
||||
|
||||
u32 getMapping(Scancode scancode) const {
|
||||
auto it = container.find(scancode);
|
||||
return it != container.end() ? it->second : HID::Keys::Null;
|
||||
}
|
||||
|
||||
void setMapping(Scancode scancode, u32 key) { container[scancode] = key; }
|
||||
|
||||
static InputMappings DefaultKeyboardMappings();
|
||||
|
||||
private:
|
||||
Container container;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue