Merge pull request #29 from cmchick/master

Add WIN32 escape key
This commit is contained in:
CNLohr 2016-10-08 18:19:42 -04:00 committed by GitHub
commit f701c23713

View file

@ -22,11 +22,18 @@ struct SoundDriver * sd;
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#define ESCAPE_KEY 0x1B
void WindowsTerm() void WindowsTerm()
{ {
CloseSound( sd ); CloseSound( sd );
} }
#else
#define ESCAPE_KEY 65307
#endif #endif
float DeltaFrameTime = 0; float DeltaFrameTime = 0;
@ -69,7 +76,7 @@ void HandleKey( int keycode, int bDown )
if( c == '0' && bDown ) { gKey = 0; nf->base_hz = 55 * pow( 2, gKey / 12.0 ); ChangeNFParameters( nf ); } if( c == '0' && bDown ) { gKey = 0; nf->base_hz = 55 * pow( 2, gKey / 12.0 ); ChangeNFParameters( nf ); }
if( c == 'E' && bDown ) show_debug_basic = !show_debug_basic; if( c == 'E' && bDown ) show_debug_basic = !show_debug_basic;
if( c == 'K' && bDown ) DumpParameters(); if( c == 'K' && bDown ) DumpParameters();
if( keycode == 65307 ) exit( 0 ); if( keycode == ESCAPE_KEY ) exit( 0 );
printf( "Key: %d -> %d\n", keycode, bDown ); printf( "Key: %d -> %d\n", keycode, bDown );
KeyHappened( keycode, bDown ); KeyHappened( keycode, bDown );
} }