Page 1 of 1

Quitting a program properly ?

Posted: Fri May 30, 2014 1:40 am
by spiny
Hi Guys,
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) } }
   
}

Re: Quitting a program properly ?

Posted: Fri May 30, 2014 1:47 am
by spiny
well, 20 seconds after I post this, I see possibly why ... :D

I've changed while (1) ('can be ignored') to while(0) ('definitely close') and it now quits to the file selector, but the music does not stop, but I think I'm getting there :)

Re: Quitting a program properly ?

Posted: Fri May 30, 2014 1:49 am
by spiny
and that was me being daft too - audio now quits too with the addition of: dlcall( svl, sv_stop, 0 ) in the quit code.

time for a beer :)

Re: Quitting a program properly ?

Posted: Tue Sep 16, 2014 12:04 pm
by Sofiajoe
nice post i really like the page