I'm trying to get a program to quit on pressing space, but at the moment all that happens that most of the program halts, but does not exit. This is the code I'm using, I'm sure its a stupid mistake somewhere, but I can't see it
Code: Select all
// key handling - this waits for space to be pressed during the program
while( get_event() )
{
key = EVT[ EVT_KEY ]
if key == KEY_SPACE { goto quit_it }
}
// quit routs - as far as I can tell, this should exit the program completely ?
quit_it:
while( 1 )
{
while( get_event() ) { if EVT[ EVT_TYPE ] == EVT_QUIT { exit (1) } }
}