[4398] | 1 | /*! |
---|
[5039] | 2 | * @file keynames.h |
---|
[7221] | 3 | * Key/button naming functions |
---|
| 4 | * |
---|
| 5 | * Converts strings to SDLK/SDL_BUTTON values and vice versa |
---|
| 6 | */ |
---|
[4398] | 7 | #ifndef _KEY_NAMES_H |
---|
| 8 | #define _KEY_NAMES_H |
---|
| 9 | |
---|
[7221] | 10 | #include <string> |
---|
| 11 | |
---|
[4398] | 12 | /** |
---|
[7661] | 13 | * @brief converts an EVKey into a String, naming the Event. |
---|
| 14 | * @param key the Key (either key or button) to convert. |
---|
| 15 | * @returns the String containing the Event. |
---|
| 16 | */ |
---|
| 17 | std::string EVToKeyName(int key); |
---|
| 18 | /** |
---|
| 19 | * @brief converts a KeyName into an Event. |
---|
| 20 | * @param keyName the Key to transform. |
---|
| 21 | * @returns the Event-Number |
---|
| 22 | */ |
---|
| 23 | int KeyNameToEV(const std::string& keyName); |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | /** |
---|
| 27 | * @brief converts a button name string to a integer representing the corresponding SDL mouse button identifier |
---|
[7221] | 28 | * @param name: the name of the mouse button |
---|
| 29 | * @return an int containing the SDL identifier of the mouse button or -1 if the button name is not valid |
---|
| 30 | */ |
---|
| 31 | int buttonnameToSDLB(const std::string& name); |
---|
[4398] | 32 | |
---|
| 33 | /** |
---|
[7661] | 34 | * @brief converst a SDL mouse button identifier to a name string |
---|
[7221] | 35 | * @param button: an SDL mouse button identifier |
---|
| 36 | * @return a pointer to a string containing the name of the mouse button |
---|
| 37 | */ |
---|
[7661] | 38 | std::string SDLBToButtonname( int button); |
---|
[4398] | 39 | |
---|
| 40 | /** |
---|
[7661] | 41 | * @brief converts a key name string to a integer representing the corresponding SDLK sym |
---|
[7221] | 42 | * @param name: the name of the key |
---|
| 43 | * @return the SDLK sym of the named key or -1 if the key name is not valid |
---|
| 44 | */ |
---|
| 45 | int keynameToSDLK(const std::string& name); |
---|
[4398] | 46 | |
---|
| 47 | /** |
---|
[7661] | 48 | * @brief converts an SDLK sym to a name string |
---|
[7221] | 49 | * @param key: the SDLK sym |
---|
| 50 | * @return a pointer to a string containig the name of the key |
---|
| 51 | */ |
---|
[7661] | 52 | std::string SDLKToKeyname( int key); |
---|
[4398] | 53 | |
---|
| 54 | #endif /* _KEY_NAMES_H */ |
---|