Hello,
I am sorry, if I don't write everything correct because English is not my native language but I'll give my best

I have a function like this:
CODE
OnKeyDown(SDLKey sym, SDLMod mod, Uint16 unicode)
{
switch(sym)
{
case SDLK_UP:
{
posYPaddle2 -= 1;
break;
}
case SDLK_DOWN:
{
posYPaddle2 += 1;
break;
}
case SDLK_w:
{
posYPaddle1 -= 1;
break;
}
case SDLK_s:
{
posYPaddle1 += 1;
break;
}
default:
{
break;
}
}
}
It catches KeyDowns on my keyboard and my current problem is, that I cannot catch 2 Keydowns at the same moment...
I try to explain it a bit deeper:
I am trying to create a Pong-clone. For this I have set the KeyRepeat to this:
CODE
SDL_EnableKeyRepeat(1, SDL_DEFAULT_REPEAT_INTERVAL / 8);
When now Player1 presses "w" and Player2 presses a moment later "UP", the KeyRepeat of Player1 is interruptet. My aim is that both Players can press their button for the paddles at the same time.
I have thought about threads, which could solve the problem, but I wanted to hear some advice from you, how to solve it because maybe there is just a very easy solution.
I hope you understand what I mean

Edit: Now two other solutions came in my mind: I could either take the mouse for Player 2 (but which is not my aim, cause I wanted both using the keyboard) or trying to send the KeyRepeat till KeyUp appears, but I don't know how to do the second idea.
Bye,
Speedy_92
This post has been edited by Speedy_92: 4 Jul, 2009 - 01:02 AM