| View previous topic :: View next topic |
| Author |
Message |
MadButch
Joined: 20 Aug 2005 Posts: 16
|
Posted: Mon Aug 29, 2005 4:37 am Post subject: SDL input question |
|
|
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 |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
|
| Back to top |
|
 |
MadButch
Joined: 20 Aug 2005 Posts: 16
|
Posted: Mon Aug 29, 2005 7:30 am Post subject: |
|
|
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 |
|
 |
|