4 int main ( int, char ** )
9 js[0] = new jsJoystick ( 0 ) ;
10 js[1] = new jsJoystick ( 1 ) ;
12 printf ( "Joystick test program.\n" ) ;
13 printf ( "~~~~~~~~~~~~~~~~~~~~~~\n" ) ;
15 if ( js[0]->notWorking () ) printf ( "Joystick 0 not detected\n" ) ;
16 if ( js[1]->notWorking () ) printf ( "Joystick 1 not detected\n" ) ;
17 if ( js[0]->notWorking () && js[1]->notWorking () ) exit ( 1 ) ;
19 ax[0] = new float [ js[0]->getNumAxes () ] ;
20 ax[1] = new float [ js[1]->getNumAxes () ] ;
24 for ( i = 0 ; i < 2 ; i++ )
25 printf ( "+---------------JS.%d-----------------", i ) ;
29 for ( i = 0 ; i < 2 ; i++ )
31 if ( js[i]->notWorking () )
32 printf ( "| ~~~ Not Detected ~~~ " ) ;
35 printf ( "| Btns " ) ;
37 for ( j = 0 ; j < js[i]->getNumAxes () ; j++ )
38 printf ( "Ax:%d ", j ) ;
47 for ( i = 0 ; i < 2 ; i++ )
48 printf ( "+------------------------------------" ) ;
54 for ( i = 0 ; i < 2 ; i++ )
56 if ( js[i]->notWorking () )
57 printf ( "| . . . . . . . . . " ) ;
62 js[i]->read ( &b, ax[i] ) ;
64 printf ( "| %04x ", b ) ;
66 for ( j = 0 ; j < js[i]->getNumAxes () ; j++ )
67 printf ( "%+.1f ", ax[i][j] ) ;
77 /* give other processes a chance */