sdl and multiple keyboard inputs

Started by
3 comments, last by i_npc 19 years, 10 months ago
i was wondering if sdl can take in mutliple inputs at the same time? (i.e. Press ''A'' + ''B'' then do some action)? or if sdl doesnt support that any suggestions on how i might go about doing this? tia.
Advertisement
No problem:
I use
keys = SDL_GetKeyState(NULL);

with keys as
unsigned char *keys = new unsigned char[256].

Then just test(I think I can just pass the character in SDL. otherwise theres some definition e.g. SDLK_SOMETHING):
if(keys[''A''] && keys[''B''])
{
}
Close, but not quite right. SDL_GetKeyState returns a pointer to an internal array, so there''s no need for you to allocate memory.
Uint8 *keys=SDL_GetKeyState(NULL);
http://sdldoc.csn.ul.ie/sdlgetkeystate.php
Oh thanks for clearing that up. Seems I''ve wasted memory.
-CProgrammer
thanks a bunches guys~

This topic is closed to new replies.

Advertisement