2001-04-26 16:45:43 +00:00
|
|
|
/*
|
|
|
|
SDL - Simple DirectMedia Layer
|
2006-02-01 06:32:25 +00:00
|
|
|
Copyright (C) 1997-2006 Sam Lantinga
|
2001-04-26 16:45:43 +00:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2006-02-01 06:32:25 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
2001-04-26 16:45:43 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2006-02-01 06:32:25 +00:00
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2001-04-26 16:45:43 +00:00
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2006-02-01 06:32:25 +00:00
|
|
|
Lesser General Public License for more details.
|
2001-04-26 16:45:43 +00:00
|
|
|
|
2006-02-01 06:32:25 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2001-04-26 16:45:43 +00:00
|
|
|
|
|
|
|
Sam Lantinga
|
2001-12-14 12:37:47 +00:00
|
|
|
slouken@libsdl.org
|
2001-04-26 16:45:43 +00:00
|
|
|
*/
|
|
|
|
|
2006-07-10 21:04:37 +00:00
|
|
|
/**
|
|
|
|
* \file SDL_keyboard.h
|
|
|
|
*
|
|
|
|
* Include file for SDL keyboard event handling
|
|
|
|
*/
|
2001-04-26 16:45:43 +00:00
|
|
|
|
|
|
|
#ifndef _SDL_keyboard_h
|
|
|
|
#define _SDL_keyboard_h
|
|
|
|
|
2006-02-10 03:19:02 +00:00
|
|
|
#include "SDL_stdinc.h"
|
2006-02-10 06:48:43 +00:00
|
|
|
#include "SDL_error.h"
|
2001-04-26 16:45:43 +00:00
|
|
|
#include "SDL_keysym.h"
|
|
|
|
|
|
|
|
#include "begin_code.h"
|
|
|
|
/* Set up for C function definitions, even when using C++ */
|
|
|
|
#ifdef __cplusplus
|
2006-07-10 21:04:37 +00:00
|
|
|
/* *INDENT-OFF* */
|
2001-04-26 16:45:43 +00:00
|
|
|
extern "C" {
|
2006-07-10 21:04:37 +00:00
|
|
|
/* *INDENT-ON* */
|
2001-04-26 16:45:43 +00:00
|
|
|
#endif
|
|
|
|
|
2006-07-10 21:04:37 +00:00
|
|
|
/**
|
|
|
|
* \struct SDL_keysym
|
|
|
|
*
|
|
|
|
* \brief The SDL keysym structure, used in key events.
|
2001-04-26 16:45:43 +00:00
|
|
|
*/
|
2006-07-10 21:04:37 +00:00
|
|
|
typedef struct SDL_keysym
|
|
|
|
{
|
|
|
|
Uint8 scancode; /**< keyboard specific scancode */
|
|
|
|
Uint8 padding[3]; /**< alignment padding */
|
|
|
|
Uint16 sym; /**< SDL virtual keysym */
|
|
|
|
Uint16 mod; /**< current key modifiers */
|
|
|
|
Uint32 unicode; /**< OBSOLETE, use SDL_TextInputEvent instead */
|
2001-04-26 16:45:43 +00:00
|
|
|
} SDL_keysym;
|
|
|
|
|
|
|
|
/* Function prototypes */
|
2006-07-10 21:04:37 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \fn int SDL_GetNumKeyboards(void)
|
|
|
|
*
|
|
|
|
* \brief Get the number of keyboard input devices available.
|
|
|
|
*
|
|
|
|
* \sa SDL_SelectKeyboard()
|
|
|
|
*/
|
|
|
|
extern DECLSPEC int SDLCALL SDL_GetNumKeyboards(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \fn int SDL_SelectKeyboard(int index)
|
|
|
|
*
|
|
|
|
* \brief Set the index of the currently selected keyboard.
|
|
|
|
*
|
|
|
|
* \return The index of the previously selected keyboard.
|
|
|
|
*
|
|
|
|
* \note You can query the currently selected keyboard by passing an index of -1.
|
|
|
|
*
|
|
|
|
* \sa SDL_GetNumKeyboards()
|
|
|
|
*/
|
|
|
|
extern DECLSPEC int SDLCALL SDL_SelectKeyboard(int index);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \fn int SDL_EnableUNICODE(int enable)
|
|
|
|
*
|
|
|
|
* \brief Enable/Disable UNICODE translation of keyboard input.
|
|
|
|
*
|
|
|
|
* \param enable 1 to enable translation, 0 to disable translation, -1 to query translation
|
|
|
|
*
|
|
|
|
* \return The previous state of keyboard translation
|
|
|
|
*
|
|
|
|
* \note This translation has some overhead, so translation defaults off.
|
2001-04-26 16:45:43 +00:00
|
|
|
*/
|
2002-04-11 14:35:16 +00:00
|
|
|
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
|
2001-04-26 16:45:43 +00:00
|
|
|
|
2006-07-10 21:04:37 +00:00
|
|
|
/**
|
|
|
|
* \fn Uint8 *SDL_GetKeyState(int *numkeys)
|
|
|
|
*
|
|
|
|
* \brief Get a snapshot of the current state of the selected keyboard.
|
|
|
|
*
|
|
|
|
* \return An array of keystates, indexed by the SDLK_* syms.
|
|
|
|
*
|
|
|
|
* Example:
|
2001-04-26 16:45:43 +00:00
|
|
|
* Uint8 *keystate = SDL_GetKeyState(NULL);
|
|
|
|
* if ( keystate[SDLK_RETURN] ) ... <RETURN> is pressed.
|
|
|
|
*/
|
2006-07-10 21:04:37 +00:00
|
|
|
extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyState(int *numkeys);
|
2001-04-26 16:45:43 +00:00
|
|
|
|
2006-07-10 21:04:37 +00:00
|
|
|
/**
|
|
|
|
* \fn SDLMod SDL_GetModState(void)
|
|
|
|
*
|
|
|
|
* \brief Get the current key modifier state for the selected keyboard.
|
2001-04-26 16:45:43 +00:00
|
|
|
*/
|
2002-04-11 14:35:16 +00:00
|
|
|
extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
|
2001-04-26 16:45:43 +00:00
|
|
|
|
2006-07-10 21:04:37 +00:00
|
|
|
/**
|
|
|
|
* \fn void SDL_SetModState(SDLMod modstate)
|
|
|
|
*
|
|
|
|
* \brief Set the current key modifier state for the selected keyboard.
|
|
|
|
*
|
|
|
|
* \note This does not change the keyboard state, only the key modifier flags.
|
2001-04-26 16:45:43 +00:00
|
|
|
*/
|
2002-04-11 14:35:16 +00:00
|
|
|
extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
|
2001-04-26 16:45:43 +00:00
|
|
|
|
2006-07-10 21:04:37 +00:00
|
|
|
/**
|
|
|
|
* \fn const char *SDL_GetKeyName(SDLKey key)
|
|
|
|
*
|
|
|
|
* \brief Get the name of an SDL virtual keysym
|
2001-04-26 16:45:43 +00:00
|
|
|
*/
|
2006-07-10 21:04:37 +00:00
|
|
|
extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDLKey key);
|
2001-04-26 16:45:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Ends C function definitions when using C++ */
|
|
|
|
#ifdef __cplusplus
|
2006-07-10 21:04:37 +00:00
|
|
|
/* *INDENT-OFF* */
|
2001-04-26 16:45:43 +00:00
|
|
|
}
|
2006-07-10 21:04:37 +00:00
|
|
|
/* *INDENT-ON* */
|
2001-04-26 16:45:43 +00:00
|
|
|
#endif
|
|
|
|
#include "close_code.h"
|
|
|
|
|
|
|
|
#endif /* _SDL_keyboard_h */
|
2006-07-10 21:04:37 +00:00
|
|
|
|
|
|
|
/* vi: set ts=4 sw=4 expandtab: */
|