diff --git a/sdljpd b/sdljpd index 21fc511..7ce6176 100755 Binary files a/sdljpd and b/sdljpd differ diff --git a/sdljpd.c b/sdljpd.c index 9d2cff9..de00840 100644 --- a/sdljpd.c +++ b/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);*/ diff --git a/sdljpd.c~ b/sdljpd.c~ index 9d2cff9..2feb85a 100644 --- a/sdljpd.c~ +++ b/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);*/