forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Input in SDL

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Tinnus



Joined: 29 Jul 2006
Posts: 67

PostPosted: Mon Jan 29, 2007 1:24 pm    Post subject: Input in SDL Reply with quote

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
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Mon Jan 29, 2007 1:54 pm    Post subject: Reply with quote

See tests/SDL in the psp SVN repository, it has an example of reading keys.
Back to top
View user's profile Send private message
Tinnus



Joined: 29 Jul 2006
Posts: 67

PostPosted: Tue Jan 30, 2007 12:11 am    Post subject: Reply with quote

Solved, thanks :)
_________________
Let's see what the PSP reserves... well, I'd say anything is better than Palm OS.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group