[Plib-cvs] plib/examples/src/pw pw_demo.cxx,1.4,1.5
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2004-03-20 02:31:11
|
Update of /cvsroot/plib/plib/examples/src/pw In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1323/plib/examples/src/pw Modified Files: pw_demo.cxx Log Message: Fixed key-repeat problem in PW and enhanced demo program to make it obvious that it's fixed. Index: pw_demo.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/pw/pw_demo.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pw_demo.cxx 24 Feb 2004 02:06:03 -0000 1.4 +++ pw_demo.cxx 20 Mar 2004 02:21:18 -0000 1.5 @@ -38,11 +38,25 @@ } +char keyIsDown [ 512 ] = { 0 } ; + void kbFunc ( int key, int updn, int x, int y ) { - fprintf ( stderr, "Keyboard key %d dirn %d at (%4dx%4d)\n", + fprintf ( stderr, "Keyboard key %d dirn %d at (%4dx%4d) ", key, updn, x, y ) ; + keyIsDown [ key ] = (updn==PW_DOWN) ; + + for ( int i = 0 ; i < 512 ; i++ ) + if ( keyIsDown [ i ] ) + { + if ( i > ' ' && i < 0x7F ) + fprintf ( stderr, "%c ", i ) ; + else + fprintf ( stderr, "0x%2x ", i ) ; + } + + fprintf ( stderr, "\n" ) ; if ( key == 0x1B ) /* ESC */ { pwCleanup () ; |