diff options
author | chai <chaifix@163.com> | 2019-03-14 23:12:54 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-03-14 23:12:54 +0800 |
commit | 8644e03586ac9c39741f62cbcbce87b18805538c (patch) | |
tree | 72021765f5262b7f2f7eebe299fd4e1aaa7c89b7 /Source/Asura.Engine/input/keyboard.h | |
parent | 8d8c4ff1664625e7428d0d31cd798d9321680cb2 (diff) |
*大小写
Diffstat (limited to 'Source/Asura.Engine/input/keyboard.h')
-rw-r--r-- | Source/Asura.Engine/input/keyboard.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/Source/Asura.Engine/input/keyboard.h b/Source/Asura.Engine/input/keyboard.h new file mode 100644 index 0000000..488209b --- /dev/null +++ b/Source/Asura.Engine/input/keyboard.h @@ -0,0 +1,73 @@ +#ifndef __ASURA_INPUT_KEYBOARD_H__ +#define __ASURA_INPUT_KEYBOARD_H__ + +#include <SDL2/SDL.h> + +#include "InputDevice.hpp" +#include "Scripting/Portable.h" + +namespace AsuraEngine +{ + namespace Input + { + + class Keyboard ASURA_FINAL : public InputDevice<Keyboard> + { + public: + + // صö + #include "Keyboard.defs" + + Keyboard(); + + void SetKeyRepeat(bool enable); + bool HasKeyRepeat() const; + bool IsDown(const std::vector<Key> &keylist) const; + bool IsScancodeDown(const std::vector<Scancode> &scancodelist) const; + + Key GetKeyFromScancode(Scancode scancode) const; + Scancode GetScancodeFromKey(Key key) const; + + void SetTextInput(bool enable); + void SetTextInput(bool enable, double x, double y, double w, double h); + bool HasTextInput() const; + bool HasScreenKeyboard() const; + + bool GetConstant(Scancode in, SDL_Scancode &out); + bool GetConstant(SDL_Scancode in, Scancode &out); + + private: + + ~Keyboard(); + + public: + + //---------------------------------------------------------------------------------------------------------- + + LUAX_DECL_SINGLETON(Keyboard); // ͨAsuraEngine.KeyboardֱӷʣûNew + + LUAX_DECL_ENUM(Key); + LUAX_DECL_ENUM(ScanCode); + + LUAX_DECL_METHOD(SetKeyRepeat); + LUAX_DECL_METHOD(HasKeyRepeat); + LUAX_DECL_METHOD(IsDown); + LUAX_DECL_METHOD(IsScancodeDown); + + LUAX_DECL_METHOD(GetKeyFromScancode); + LUAX_DECL_METHOD(GetScancodeFromKey); + + LUAX_DECL_METHOD(SetTextInput); + LUAX_DECL_METHOD(HasTextInput); + LUAX_DECL_METHOD(HasScreenKeyboard); + + LUAX_DECL_METHOD(GetConstant); + + //---------------------------------------------------------------------------------------------------------- + + }; + + } +} + +#endif
\ No newline at end of file |