Browse Source

joystick set up

main
h3ndrik 13 years ago
parent
commit
cea708e024
  1. BIN
      sdljpd
  2. 18
      sdljpd.c
  3. 19
      sdljpd.c~

BIN
sdljpd

Binary file not shown.

18
sdljpd.c

@ -110,6 +110,8 @@ SDL_Color color={255,125,0};
TTF_Font *font;
SDL_Joystick *joystick;
/** \brief Hier Raeumen wir nach Programablauf auf.
*
* \param returnCode Der Zurueckzugebende Return Code
@ -121,6 +123,8 @@ void Quit( int returnCode )
Mix_HaltMusic();
Mix_FreeMusic(music);
music = NULL;
SDL_JoystickClose(joystick);
SDL_FreeSurface(panel);
SDL_FreeSurface(text);
@ -610,7 +614,7 @@ int main( int argc, char **argv )
printf("\033[33m sdljpd: \033[32m Parrallel port found at 0x%x. \033[m \n", port_adr);
*/
filefoo();
if(TTF_Init()==-1) {
@ -627,7 +631,7 @@ int main( int argc, char **argv )
/* sprintf(wmcapt,"glpong - %s vs ", player_a );*/
/* initialize SDL */
if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0 )
if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0 )
{
fprintf( stderr, "Video initialization failed: %s\n",
SDL_GetError( ) );
@ -652,7 +656,15 @@ int main( int argc, char **argv )
SDL_GetError( ) );
Quit( 1 );
}
if(joystick = SDL_JoystickOpen (0) == NULL) {
printf("Unable to open joystick!\n");
exit(1);
}
SDL_JoystickEventState ( SDL_QUERY );
SDL_WM_SetCaption(wmcapt, NULL);
/*SDL_WM_SetIcon(SDL_LoadBMP("glpong.bmp"),NULL);*/

19
sdljpd.c~

@ -110,6 +110,8 @@ SDL_Color color={255,125,0};
TTF_Font *font;
SDL_Joystick *joystick;
/** \brief Hier Raeumen wir nach Programablauf auf.
*
* \param returnCode Der Zurueckzugebende Return Code
@ -121,6 +123,8 @@ void Quit( int returnCode )
Mix_HaltMusic();
Mix_FreeMusic(music);
music = NULL;
SDL_JoystickClose(joystick);
SDL_FreeSurface(panel);
SDL_FreeSurface(text);
@ -610,7 +614,7 @@ int main( int argc, char **argv )
printf("\033[33m sdljpd: \033[32m Parrallel port found at 0x%x. \033[m \n", port_adr);
*/
filefoo();
if(TTF_Init()==-1) {
@ -627,7 +631,7 @@ int main( int argc, char **argv )
/* sprintf(wmcapt,"glpong - %s vs ", player_a );*/
/* initialize SDL */
if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0 )
if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0 )
{
fprintf( stderr, "Video initialization failed: %s\n",
SDL_GetError( ) );
@ -652,7 +656,16 @@ int main( int argc, char **argv )
SDL_GetError( ) );
Quit( 1 );
}
if(joystick = SDL_JoystickOpen (0) == NULL) {
printf("Unable to open joystick!\n");
exit(1);
}
/*
//SDL_JoystickEventState (SDL_ENABLE);
// this will alter the behaviour of the event queue of the sdl system
SDL_JoystickEventState ( SDL_QUERY );
*/
SDL_WM_SetCaption(wmcapt, NULL);
/*SDL_WM_SetIcon(SDL_LoadBMP("glpong.bmp"),NULL);*/

Loading…
Cancel
Save