Hi,
Karl Bartel wrote:
I?d like to have a very easy funtion that returns 1 when the requested
key is pressed. But I don?t know, how to pass the keyname. Excuse me if
this question is too stupid, but I?m not very experienced in C.)
{
Uint8
*keys;SDL_PollEvent(&event);
keys =
SDL_GetKeyState(NULL);if (keys[ ???
]==SDL_PRESSED)
{return(1);} else
{return(0);}
}Thanks for any help, Karl.
SDL/include/SDL_keysym.h contains the typedef, you are looking for:
typedef enum {
/* The keyboard syms have been cleverly chosen to map to ASCII
*/
SDLK_UNKNOWN = 0,
SDLK_FIRST = 0,
SDLK_BACKSPACE = 8,
SNIPPED
SDLK_EURO = 321, /* Some european
keyboards */
/* Add any other keys here */
SDLK_LAST
} SDLKey;
–>> int FSCP_keypressed(SDLKey testKey)
Does this answer your question ?–
Karsten-O. Laux
klaux at student.uni-kl.de
http://www.rhrk.uni-kl.de/~klaux
UIN 21614933 (Bert)