Quitting a program properly ?

Pixilang programming language
User avatar
spiny
Posts: 46
Joined: Mon Jul 19, 2010 4:28 pm

Quitting a program properly ?

Postby spiny » Fri May 30, 2014 1:40 am

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) } }
   
}

User avatar
spiny
Posts: 46
Joined: Mon Jul 19, 2010 4:28 pm

Re: Quitting a program properly ?

Postby spiny » Fri May 30, 2014 1:47 am

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 :)

User avatar
spiny
Posts: 46
Joined: Mon Jul 19, 2010 4:28 pm

Re: Quitting a program properly ?

Postby spiny » Fri May 30, 2014 1:49 am

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 :)

Sofiajoe
Posts: 1
Joined: Tue Sep 16, 2014 12:02 pm

Re: Quitting a program properly ?

Postby Sofiajoe » Tue Sep 16, 2014 12:04 pm

nice post i really like the page
Subscribe for online Pass4sure C4040-124 training and get guaranteed success in real exam using The Johns Hopkins University and JN0-101 practice exam.More details available visit now wikipedia and CHECKPOINT site best of luck


Return to “Pixilang”

Who is online

Users browsing this forum: No registered users and 1 guest

cron