Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

i_npc

sdl and multiple keyboard inputs

This topic is 5138 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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''])
{
}

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!