Computer Science Canada Why can't i get character inside this code |
Author: | hello123 [ Sun Jan 13, 2008 8:33 pm ] |
Post subject: | Why can't i get character inside this code |
import GUI var startGameButton, goodByeButton : int var pictureID : int var picHeight, picWidth : int var key : string (1) var wrd : real setscreen ("graphics:640;480") setscreen ("nocursor") setscreen ("noecho") procedure title locate (1, 30) put "Let's Play Hide N Seek" colourback (white) end title procedure background drawfillbox (0, 0, 640, 500, 7) end background procedure displayPic pictureID := Pic.FileNew ("das_keyboard_lrg.jpg") picHeight := Pic.Height (pictureID) picWidth := Pic.Width (pictureID) Pic.Draw (pictureID, 0, 0, picMerge) getch (key) end displayPic procedure mainMenu GUI.Show (startGameButton) GUI.Show (goodByeButton) loop exit when GUI.ProcessEvent end loop end mainMenu procedure goodBye cls locate (14, 30) put "Thanks for playing" locate (15, 30) put " you are now exiting" loop exit end loop end goodBye procedure display locate (5, 1) put "Enter your first number:" get wrd end display procedure StartGame cls locate (14, 30) %displayPic display end StartGame procedure introduction title locate (5, 1) put "Welcome all.This is a hide and seek game. The objective of this game is to find the hidden smilely face underneath the computer equipment or to name all ten computer equipment on the screen. Have Fun!" end introduction introduction %Buttons startGameButton := GUI.CreateButtonFull (320, 100, 100, "Start Game", StartGame, 0, '^I', false) goodByeButton := GUI.CreateButtonFull (100, 100, 100, "Exit", goodBye, 0, '^I', false) background introduction mainMenu StartGame goodBye |
Author: | hello123 [ Sun Jan 13, 2008 8:38 pm ] |
Post subject: | RE:Why can\'t i get character inside this code |
why can't i get character inside the start game part |
Author: | Tony [ Sun Jan 13, 2008 9:02 pm ] |
Post subject: | RE:Why can\'t i get character inside this code |
because your code is stuck in the GUI.ProcessEvents loop. |
Author: | hello123 [ Sun Jan 13, 2008 9:07 pm ] |
Post subject: | RE:Why can\'t i get character inside this code |
how do u reccomend i fix this problem |
Author: | Tony [ Sun Jan 13, 2008 9:11 pm ] |
Post subject: | RE:Why can\'t i get character inside this code |
Call GUI.Quit to disable GUI and exit the loop. |
Author: | LaZ3R [ Sun Jan 13, 2008 9:49 pm ] |
Post subject: | RE:Why can\'t i get character inside this code |
How about this: DON'T USE GUI. For the love of god, why are all of the students in my school and others schools so tempted to use GUI? Much easier to design your own menu's and work from that... |
Author: | hello123 [ Sun Jan 13, 2008 10:02 pm ] |
Post subject: | RE:Why can\'t i get character inside this code |
that may b so but the use of GUI is required in this ISU accordin to my teacher |
Author: | LaZ3R [ Sun Jan 13, 2008 10:09 pm ] |
Post subject: | RE:Why can\'t i get character inside this code |
Wow,that's pretty lame then. :p |
Author: | Tony [ Sun Jan 13, 2008 10:13 pm ] |
Post subject: | RE:Why can\'t i get character inside this code |
LaZ3R - you've got to realize that this teacher's entire class is on here. It would be nice for the teacher to register and participate as well though. |
Author: | Gooie [ Mon Jan 14, 2008 12:54 am ] |
Post subject: | Re: Why can't i get character inside this code |
I agree LaZ3R, GUI only cause problems. I used it once had one problem and, I gave up on it. Plus, making your own menu's is more fun. I think a teacher should be joyed to see that a student wants to do it themselves. |
Author: | Sean [ Mon Jan 14, 2008 7:39 am ] | ||||||
Post subject: | Re: Why can't i get character inside this code | ||||||
You can do your setscreen in one line, not needing three like you had, just add commas in.
Saves you from drawing a pointless square.
What is the point in the loop here, really doesn't look like it is doing anything.. |
Author: | LaZ3R [ Mon Jan 14, 2008 7:04 pm ] |
Post subject: | Re: RE:Why can\'t i get character inside this code |
Tony @ Sun Jan 13, 2008 10:13 pm wrote: LaZ3R - you've got to realize that this teacher's entire class is on here. It would be nice for the teacher to register and participate as well though.
I'm fully aware of that :p That doesn't change my viewpoint on GUI sucking so much however =) |