9 #include <string.h> // plib/js.h should really include this !!!!!!
14 int main ( int, char ** )
18 int i, j, t, useful[Z];
20 for ( i = 0; i < Z; i++ )
21 js[i] = new jsJoystick ( i ) ;
23 printf ( "Joystick test program.\n" ) ;
24 printf ( "~~~~~~~~~~~~~~~~~~~~~~\n" ) ;
27 for ( i = 0; i < Z; i++ )
28 { useful[i] = ! ( js[i]->notWorking () );
31 #ifdef FG_PLIB_JOYSTICK_GETNAME
32 printf ( "Joystick %i: \"%s\"\n", i, js[i]->getName() ) ;
34 } else printf ( "Joystick %i not detected\n", i ) ;
36 if ( t == 0 ) exit ( 1 ) ;
38 for ( i = 0; i < Z; i++ )
40 ax[i] = new float [ js[i]->getNumAxes () ] ;
42 for ( i = 0 ; i < Z ; i++ )
44 printf ( "+--------------------JS.%d----------------------", i ) ;
48 for ( i = 0 ; i < Z ; i++ )
51 if ( js[i]->notWorking () )
52 printf ( "| ~~~ Not Detected ~~~ " ) ;
55 printf ( "| Btns " ) ;
57 for ( j = 0 ; j < js[i]->getNumAxes () ; j++ )
58 printf ( "Ax:%1d ", j ) ;
67 for ( i = 0 ; i < Z ; i++ )
69 printf ( "+----------------------------------------------" ) ;
75 for ( i = 0 ; i < Z ; i++ )
78 if ( js[i]->notWorking () )
79 printf ( "| . . . . . . . . . . . " ) ;
84 js[i]->read ( &b, ax[i] ) ;
86 printf ( "| %04x ", b ) ;
88 for ( j = 0 ; j < js[i]->getNumAxes () ; j++ )
89 printf ( "%+.1f ", ax[i][j] ) ;
99 /* give other processes a chance */