| View previous topic :: View next topic |
| Author |
Message |
Tinnus
Joined: 29 Jul 2006 Posts: 67
|
Posted: Mon Jan 29, 2007 1:24 pm Post subject: Input in SDL |
|
|
Stupid question, what do I have to do to get joystick events in SDL correspondent to the PSP buttons (as says in the readme)?
I've never worked with joysticks in SDL so I'm kinda stuck. I have the following already (related to that) and it still doesn't work. According to what I got of the readme, btn should contain the number of the button (0-13).
Maybe the code is right though and I'm just screwing somewhere else since there's a lot of code between that and the final result.
| Code: | SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK);
SDL_JoystickOpen(0);
SDL_JoystickEventState(SDL_ENABLE);
//and to read events:
else if(event.type == SDL_JOYBUTTONDOWN)
{
int btn = event.jbutton.button;
//etc |
_________________ Let's see what the PSP reserves... well, I'd say anything is better than Palm OS. |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Mon Jan 29, 2007 1:54 pm Post subject: |
|
|
| See tests/SDL in the psp SVN repository, it has an example of reading keys. |
|
| Back to top |
|
 |
Tinnus
Joined: 29 Jul 2006 Posts: 67
|
Posted: Tue Jan 30, 2007 12:11 am Post subject: |
|
|
Solved, thanks :) _________________ Let's see what the PSP reserves... well, I'd say anything is better than Palm OS. |
|
| Back to top |
|
 |
|