diff options
author | Stijn Buys <ingar@osirion.org> | 2015-01-03 16:54:18 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2015-01-03 16:54:18 +0000 |
commit | 85671408eed36060f5ff4799f2ee153d66e16282 (patch) | |
tree | f76d052c751507953996cf32f578b6d15ca172f5 /src/client/keyboard.h | |
parent | 87db4deac81853737d7fb7c44a4e5eaecc3bc2bd (diff) |
Minor cleanup of client::Action and client::Keyboard code,
added Action::FreeLook defintions.
Diffstat (limited to 'src/client/keyboard.h')
-rw-r--r-- | src/client/keyboard.h | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/src/client/keyboard.h b/src/client/keyboard.h index f533838..0742b9c 100644 --- a/src/client/keyboard.h +++ b/src/client/keyboard.h @@ -21,7 +21,11 @@ namespace client class Keyboard { -public: +public: + typedef std::map<unsigned int, Key *> Keys; + + typedef std::list<Action *> Actions; + Keyboard(); ~Keyboard(); @@ -39,21 +43,24 @@ public: /// celar all key binds void unbindall(); + + /// reset key states + void reset(); /// list keyboard key names - void list_keys(); + void list_keys() const; /// list actions - void list_actions(); + void list_actions() const; /// list keyboard binds - void list_binds(); + void list_binds() const; /// load keyboard binds - void load_binds(); + void load_binds() const; /// save keyboard binds - void save_binds(); + void save_binds() const; /// a key has been pressed Key *press(unsigned int sym); @@ -64,36 +71,23 @@ public: /// a key has been pressed Key *release(unsigned int sym); - typedef std::map<unsigned int, Key *>::iterator iterator; - - inline iterator begin() { - return keys.begin(); - } - - inline iterator end() { - return keys.end(); - } - /// convert SDL_keysym to a keystroke - static unsigned int translate_keysym(int keysym, int modifier); + static unsigned int translate_keysym(const int keysym, const int modifiers); + + inline Keys & keys() + { + return _keys; + } private: Key *add_key(const char *name, const unsigned int keysym, const char ascii = 0, const char *bind = 0); - Action *add_action(const char *name, Action::Identifier action, const char *info = 0); + Action *add_action(const char *name, Action::Identifier id, const char *description = 0); - std::map<unsigned int, Key *> keys; - std::list<Action *> actions; - - bool numlock; - bool capslock; + Keys _keys; + Actions _actions; }; -/// set the keyboard input mode -/** @param input true for console input, false for game input - */ -//void setkeyboardmode(bool input); - } #endif // __INCLUDED_CLIENT_KEYBOARD_H__ |