Input in SDL

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Tinnus
Posts: 67
Joined: Sat Jul 29, 2006 1:12 am

Input in SDL

Post by Tinnus »

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: Select all

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.
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

See tests/SDL in the psp SVN repository, it has an example of reading keys.
Tinnus
Posts: 67
Joined: Sat Jul 29, 2006 1:12 am

Post by Tinnus »

Solved, thanks :)
Let's see what the PSP reserves... well, I'd say anything is better than Palm OS.
Post Reply