Computer Science Canada Putting exit command |
Author: | Jim [ Fri Jan 11, 2008 8:54 am ] |
Post subject: | Putting exit command |
Currently working on an intro screen for a game but ive run into a problem with my quit button. I dont exactly know how to add an exit condition or exit command into it. My Being and Quit buttons are both procedures, would be great if i could possibly get some feed back on how to put the exit into the quit procedure. Thanks. Current Program import GUI var font1 : int font1 := Font.New ("comicsans:14") Font.Draw ("A Caves and Lizards Production", 175, 175, font1, red) var mypic : int := Pic.FileNew ("LZRD.bmp") Pic.Draw (mypic, maxx div 2.5, maxy div 2, 0) Pic.Free (mypic) procedure Begin locate (1, 1) put "You Have Selected To Play" end Begin procedure Quit locate (1, 1) put "Bye!" end Quit var button2 : int := GUI.CreateButton (25, 50, 0, "Play", Begin) var button1 : int := GUI.CreateButton (25, 25, 0, "Exit", Quit) loop exit when GUI.ProcessEvent end loop |
Author: | Tony [ Fri Jan 11, 2008 10:26 am ] | ||
Post subject: | RE:Putting exit command | ||
that is because your quit procedure doesn't do anything, it just says it's "bye", but it has no effect on your
which will just keep on running until GUI.ProcessEvent return true. Calling GUI.Quit at any point will do that. |
Author: | Jim [ Fri Jan 11, 2008 10:35 am ] |
Post subject: | Re: Putting exit command |
Ah, kk that works, thanks . If I wanted to exit the whole run window would it be a different command? thanks again |
Author: | Tony [ Fri Jan 11, 2008 10:55 am ] |
Post subject: | RE:Putting exit command |
well GUI.Quit just makes you exit out of the loop. If you have some code after it, that will be executed. I think Turing's quit might quit the entire application. I don't remember if the run window actually closes at completion. |
Author: | Sean [ Fri Jan 11, 2008 12:50 pm ] |
Post subject: | Re: Putting exit command |
If you make a window from a variable then the Window.Close function would be used. |
Author: | Carey [ Fri Jan 11, 2008 12:56 pm ] | ||
Post subject: | RE:Putting exit command | ||
Or if you have
|
Author: | Jim [ Fri Jan 11, 2008 1:01 pm ] |
Post subject: | Re: Putting exit command |
Cool thanks guys, appreciate everyones help |
Author: | StealthArcher [ Fri Jan 11, 2008 1:30 pm ] |
Post subject: | Re: Putting exit command |
Tony @ Fri Jan 11, 2008 9:55 am wrote: well GUI.Quit just makes you exit out of the loop. If you have some code after it, that will be executed.
I think Turing's quit might quit the entire application. I don't remember if the run window actually closes at completion. As for the quit command, don't use it, it will always cause a warning window to come up stating error gibberish at the user, even after compilation. |