mirror of
https://github.com/love2d/love.git
synced 2026-08-19 12:14:20 +02:00
Added love.keyboard.getKeyFromScancode and love.keyboard.getScancodeFromKey. Resolves issue #982.
Scancodes represent a physical key independent of the keyboard's current layout. For example, pressing the key located where 'q' is on a U.S. keyboard will produce the key 'q' and the scancode 'q' when using a U.S. keyboard layout, but when using a French keyboard layout it will produce the key 'a' and the scancode 'q'. Scancodes are useful for creating default controls that have the same physical locations on on all keyboards.
This commit is contained in:
@@ -48,6 +48,9 @@ public:
|
||||
bool hasKeyRepeat() const;
|
||||
bool isDown(Key *keylist) const;
|
||||
|
||||
Key getKeyFromScancode(Scancode scancode) const;
|
||||
Scancode getScancodeFromKey(Key key) const;
|
||||
|
||||
void setTextInput(bool enable);
|
||||
bool hasTextInput() const;
|
||||
|
||||
@@ -60,6 +63,9 @@ private:
|
||||
static const SDL_Keycode *createKeyMap();
|
||||
static const SDL_Keycode *keymap;
|
||||
|
||||
static EnumMap<Scancode, SDL_Scancode, SDL_NUM_SCANCODES>::Entry scancodeEntries[];
|
||||
static EnumMap<Scancode, SDL_Scancode, SDL_NUM_SCANCODES> scancodes;
|
||||
|
||||
}; // Keyboard
|
||||
|
||||
} // sdl
|
||||
|
||||
Reference in New Issue
Block a user