1 | /*! |
---|
2 | * @file keynames.h |
---|
3 | * Key/button naming functions |
---|
4 | * |
---|
5 | * Converts strings to SDLK/SDL_BUTTON values and vice versa |
---|
6 | */ |
---|
7 | #ifndef _KEY_NAMES_H |
---|
8 | #define _KEY_NAMES_H |
---|
9 | |
---|
10 | #include <string> |
---|
11 | |
---|
12 | /** |
---|
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 |
---|
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); |
---|
32 | |
---|
33 | /** |
---|
34 | * @brief converst a SDL mouse button identifier to a name string |
---|
35 | * @param button: an SDL mouse button identifier |
---|
36 | * @return a pointer to a string containing the name of the mouse button |
---|
37 | */ |
---|
38 | std::string SDLBToButtonname( int button); |
---|
39 | |
---|
40 | /** |
---|
41 | * @brief converts a key name string to a integer representing the corresponding SDLK sym |
---|
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); |
---|
46 | |
---|
47 | /** |
---|
48 | * @brief converts an SDLK sym to a name string |
---|
49 | * @param key: the SDLK sym |
---|
50 | * @return a pointer to a string containig the name of the key |
---|
51 | */ |
---|
52 | std::string SDLKToKeyname( int key); |
---|
53 | |
---|
54 | #endif /* _KEY_NAMES_H */ |
---|