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 

SDL input question

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



Joined: 20 Aug 2005
Posts: 16

PostPosted: Mon Aug 29, 2005 4:37 am    Post subject: SDL input question Reply with quote

Hello, I have a little problem getting the input working.
I made defines in my code, which use the numbers provided by the readme.psp file.

In my main loop, I have the following code to check for Up (6), Down (8) and X (2):
Code:
while( SDL_PollEvent(&theSDLEvent) )
{
   if( theSDLEvent.type == SDL_QUIT )
   {
      bContinue      = false;
   }
   else if( theSDLEvent.type == SDL_JOYBUTTONDOWN )
   {
      if( theSDLEvent.type == PSP_CTRL_UP )
      {
         theSDLGraphics.SetActiveItem( theSDLGraphics.GetActiveItem() - 1 );
      }
      else if( theSDLEvent.type == PSP_CTRL_DOWN )
      {
         theSDLGraphics.SetActiveItem( theSDLGraphics.GetActiveItem() + 1 );
      }
      else if( theSDLEvent.type == PSP_CTRL_CROSS )
      {
         Mix_PlayChannel(0, mixSounds[0], -1);
         if( theSDLGraphics.GetActiveItem() == 3 )
         {
            bContinue   = false;
         }
      }
   }
}


I know this is not perfect yet, as I should also catch the SDL_JOYBUTTONDOWN message, but it should do something...

Unfortunately, it doesn't do anything :(

Does anyone see what I'm doing wrong?
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Mon Aug 29, 2005 5:28 am    Post subject: Reply with quote

The current button maps to theSDLEvent.jbutton.button.

See http://www.libsdl.org/cgi/docwiki.cgi/SDL_20API for more information on SDL events.
Back to top
View user's profile Send private message
MadButch



Joined: 20 Aug 2005
Posts: 16

PostPosted: Mon Aug 29, 2005 7:30 am    Post subject: Reply with quote

Thanks a ton... hehe... It's always the dummy things you overlook :)
I examined the vectoroids example some more, and noticed I was also missing initialisations and the JoystickOpen command.

Everything works like a charm now.

Next step: sound and music.
And then I'm ready to start coding...
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