GP2X How Do You Do Multiple Button Presses With Sdl


GP2X_Coder

Member
Joined
May 17, 2006
Messages
220
Age
51
Location
USA
Website
mysite.verizon.net
How do you do multiple button presses with sdl?

ex: if you want to Press A and Press B at the same time how do you get sdl to register this?

Thanks.
 
Speedo Codes!

(in the main loop)
Code:
switch(event.[whatever, i cant remember this bit :D])
{
case buttona:
adown = true;
if (adown && bdown)
 DoFun();

case buttonb:
bdown = true;
if (adown && bdown)
 DoFun();
}
adown = false;
bdown = false;
Maybe something along the lines of that? The syntax is probably wrong and theres probably a way to do it directly via SDL, but hopefully that will give you an idea! Dont laugh too hard if thats BS though, I did try :S

Edit: Need to falsify the variables, silly me
 
Thanks I figure out what was wrong.
I forgot to call SDL_JoystickEventState(SDL_ENABLE); when I was initializing the joystick.

and all I have to do is this.

if ( SDL_JoystickGetButton( JoyStick, 13 ) && SDL_JoystickGetButton( JoyStick, 14 ) )
{ do what ever};
 
Back
Top