include/SDL_keyboard.h
changeset 5081 25d4feb7c127
parent 4753 11b0a6a3eb4d
child 5218 572a73d71b5f
equal deleted inserted replaced
5080:de59e0218aa2 5081:25d4feb7c127
    43 #endif
    43 #endif
    44 
    44 
    45 /**
    45 /**
    46  *  \brief The SDL keysym structure, used in key events.
    46  *  \brief The SDL keysym structure, used in key events.
    47  */
    47  */
    48 typedef struct SDL_keysym
    48 typedef struct SDL_KeySym
    49 {
    49 {
    50     SDL_scancode scancode;      /**< SDL physical key code - see ::SDL_scancode for details */
    50     SDL_ScanCode scancode;      /**< SDL physical key code - see ::SDL_ScanCode for details */
    51     SDLKey sym;                 /**< SDL virtual key code - see ::SDLKey for details */
    51     SDLKey sym;                 /**< SDL virtual key code - see ::SDLKey for details */
    52     Uint16 mod;                 /**< current key modifiers */
    52     Uint16 mod;                 /**< current key modifiers */
    53     Uint32 unicode;             /**< \deprecated use SDL_TextInputEvent instead */
    53     Uint32 unicode;             /**< \deprecated use SDL_TextInputEvent instead */
    54 } SDL_keysym;
    54 } SDL_KeySym;
    55 
    55 
    56 /* Function prototypes */
    56 /* Function prototypes */
    57 
    57 
    58 /**
    58 /**
    59  *  \brief Get the window which currently has keyboard focus.
    59  *  \brief Get the window which currently has keyboard focus.
    63 /**
    63 /**
    64  *  \brief Get a snapshot of the current state of the keyboard.
    64  *  \brief Get a snapshot of the current state of the keyboard.
    65  *  
    65  *  
    66  *  \param numkeys if non-NULL, receives the length of the returned array.
    66  *  \param numkeys if non-NULL, receives the length of the returned array.
    67  *  
    67  *  
    68  *  \return An array of key states. Indexes into this array are obtained by using ::SDL_scancode values.
    68  *  \return An array of key states. Indexes into this array are obtained by using ::SDL_ScanCode values.
    69  *  
    69  *  
    70  *  \b Example:
    70  *  \b Example:
    71  *  \code
    71  *  \code
    72  *  Uint8 *state = SDL_GetKeyboardState(NULL);
    72  *  Uint8 *state = SDL_GetKeyboardState(NULL);
    73  *  if ( state[SDL_SCANCODE_RETURN] )   {
    73  *  if ( state[SDL_SCANCODE_RETURN] )   {
    95  *  
    95  *  
    96  *  See ::SDLKey for details.
    96  *  See ::SDLKey for details.
    97  *  
    97  *  
    98  *  \sa SDL_GetKeyName()
    98  *  \sa SDL_GetKeyName()
    99  */
    99  */
   100 extern DECLSPEC SDLKey SDLCALL SDL_GetKeyFromScancode(SDL_scancode scancode);
   100 extern DECLSPEC SDLKey SDLCALL SDL_GetKeyFromScancode(SDL_ScanCode scancode);
   101 
   101 
   102 /**
   102 /**
   103  *  \brief Get the scancode corresponding to the given key code according to the
   103  *  \brief Get the scancode corresponding to the given key code according to the
   104  *         current keyboard layout.
   104  *         current keyboard layout.
   105  *  
   105  *  
   106  *  See ::SDL_scancode for details.
   106  *  See ::SDL_ScanCode for details.
   107  *  
   107  *  
   108  *  \sa SDL_GetScancodeName()
   108  *  \sa SDL_GetScancodeName()
   109  */
   109  */
   110 extern DECLSPEC SDL_scancode SDLCALL SDL_GetScancodeFromKey(SDLKey key);
   110 extern DECLSPEC SDL_ScanCode SDLCALL SDL_GetScancodeFromKey(SDLKey key);
   111 
   111 
   112 /**
   112 /**
   113  *  \brief Get a human-readable name for a scancode.
   113  *  \brief Get a human-readable name for a scancode.
   114  *  
   114  *  
   115  *  \return A pointer to a UTF-8 string that stays valid at least until the next
   115  *  \return A pointer to a UTF-8 string that stays valid at least until the next
   116  *          call to this function. If you need it around any longer, you must 
   116  *          call to this function. If you need it around any longer, you must 
   117  *          copy it.  If the scancode doesn't have a name, this function returns
   117  *          copy it.  If the scancode doesn't have a name, this function returns
   118  *          an empty string ("").
   118  *          an empty string ("").
   119  *
   119  *
   120  *  \sa SDL_scancode
   120  *  \sa SDL_ScanCode
   121  */
   121  */
   122 extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_scancode
   122 extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_ScanCode
   123                                                         scancode);
   123                                                         scancode);
   124 
   124 
   125 /**
   125 /**
   126  *  \brief Get a human-readable name for a key.
   126  *  \brief Get a human-readable name for a key.
   127  *  
   127  *