SDL++
C++wrapperfortheSDLlibrary.

devices/Keyboard.h

Go to the documentation of this file.
00001 
00021 #ifndef SDL_DEVICES_KEYBOARD_H
00022 #define SDL_DEVICES_KEYBOARD_H
00023 
00024 #include <utility>
00025 
00026 namespace sdl {
00027 namespace devices {
00028     using namespace std;
00029 
00034     struct Keyboard {
00042         static string getKeyName (SDLKey key) { return SDL_GetKeyName (key); };
00043 
00049         static pair<unsigned char*, int> keyState () {
00050             int numKeys;
00051             unsigned char* keys = SDL_GetKeyState (&numKeys);
00052             return make_pair (keys, numKeys);
00053         };
00054 
00060         static SDLMod getModState () {  return SDL_GetModState (); };
00061 
00067         static void setModState (SDLMod state) { SDL_SetModState (state); };
00068 
00077         static bool enableKeyRepeat (int delay, int interval) { return SDL_EnableKeyRepeat (delay, interval) == 0; };
00078 
00084         static bool disableKeyRepeat () { return SDL_EnableKeyRepeat (0, 0) == 0;};
00085 
00089         static void enableUnicode () { SDL_EnableUNICODE (1); };
00090 
00094         static void disableUnicode () { SDL_EnableUNICODE (0); };
00095 
00101         static bool unicodeEnabled () { return SDL_EnableUNICODE (-1) == 1; };
00102     }; //Keyboard
00103 }; //devices
00104 }; //sdl
00105 
00106 #endif //SDL_DEVICES_KEYBOARD_H
00107 
 All Classes Namespaces Files Functions Variables Typedefs