PSyMastR
\m/O__O\m/
Ok, Im using an SDL event to detect button input. This is in the top of my program:
This code is basically setup for the GP2x, but it doesn't seem to work right. I also have the key input for the PC, and am wondering what the call is for the gp2x.
Thanks alot
-Jeff (PSy)
Code:
#define GP2X_BUTTON_UP (0)
#define GP2X_BUTTON_DOWN (4)
#define GP2X_BUTTON_LEFT (2)
#define GP2X_BUTTON_RIGHT (6)
#define GP2X_BUTTON_UPLEFT (1)
#define GP2X_BUTTON_UPRIGHT (7)
#define GP2X_BUTTON_DOWNLEFT (3)
#define GP2X_BUTTON_DOWNRIGHT (5)
#define GP2X_BUTTON_CLICK (18)
#define GP2X_BUTTON_A (12)
#define GP2X_BUTTON_B (13)
#define GP2X_BUTTON_X (14)
#define GP2X_BUTTON_Y (15)
#define GP2X_BUTTON_L (10)
#define GP2X_BUTTON_R (11)
#define GP2X_BUTTON_START (8)
#define GP2X_BUTTON_SELECT (9)
#define GP2X_BUTTON_VOLUP (16)
#define GP2X_BUTTON_VOLDOWN (17)
This code is basically setup for the GP2x, but it doesn't seem to work right. I also have the key input for the PC, and am wondering what the call is for the gp2x.
Code:
int main( int argc, char **argv )
{
SDL_Event event;
Uint8 *keystate;
// Initialise SDL and Joystick
SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO);
SDL_ShowCursor (0); //Removes the mouse cursor
SDL_JoystickOpen(0); //Opens up the Joystick for use
// Initialize the screen / window
screen = SDL_SetVideoMode( 320, 240, 8, SDL_SWSURFACE
// Main loop
while (1)
{
// Handle events (key input, mainly)
while(SDL_PollEvent(&event))
{
switch(event.type)
{
case SDL_JOYBUTTONDOWN:
switch(event.jbutton.button)
{
case GP2X_BUTTON_START: // Start pressed
game.running = 0;
break;
}
break;
}
}
// If we have been told to exit, do so now
if (game.running == 0)
{
break;
}
keystate = SDL_GetKeyState( NULL );
SDL_Delay( 30 );
}
// Victory!
return cleanUp( 0 );
}
Thanks alot
-Jeff (PSy)