9 printf ( "Joystick test program.\n" ) ;
10 printf ( "~~~~~~~~~~~~~~~~~~~~~~\n" ) ;
12 if ( js0 . notWorking () ) printf ( "Joystick 0 not detected\n" ) ;
13 if ( js1 . notWorking () ) printf ( "Joystick 1 not detected\n" ) ;
14 if ( js0 . notWorking () && js1 . notWorking () ) exit ( 1 ) ;
16 js0 . setDeadBand ( 0, 0.1 ) ;
17 js0 . setDeadBand ( 1, 0.1 ) ;
18 js1 . setDeadBand ( 0, 0.1 ) ;
19 js1 . setDeadBand ( 1, 0.1 ) ;
21 float *ax0 = new float [ js0.getNumAxes () ] ;
22 float *ax1 = new float [ js1.getNumAxes () ] ;
28 if ( ! js0 . notWorking () )
30 js0 . read ( &b, ax0 ) ;
32 printf ( "JS0: b0:%s b1:%s X:%1.3f Y:%1.3f ",
33 ( b & 1 ) ? "on " : "off", ( b & 2 ) ? "on " : "off", ax0[0], ax0[1] ) ;
36 if ( ! js1 . notWorking () )
38 js1 . read ( &b, ax1 ) ;
40 printf ( "JS1: b0:%s b1:%s X:%1.3f Y:%1.3f ",
41 ( b & 1 ) ? "on " : "off", ( b & 2 ) ? "on " : "off", ax1[0], ax1[1] ) ;
47 /* give other processes a chance */