Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Why can't i get character inside this code
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
hello123




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
hello123




PostPosted: 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
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
hello123




PostPosted: 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
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
LaZ3R




PostPosted: 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...
hello123




PostPosted: 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
LaZ3R




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Gooie




PostPosted: 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.
Sean




PostPosted: Mon Jan 14, 2008 7:39 am   Post subject: Re: Why can't i get character inside this code

Turing:

setscreen ("graphics:640;480,nocursor,neecho")


You can do your setscreen in one line, not needing three like you had, just add commas in.

Turing:

procedure background
colourback (7)
cls
end background


Saves you from drawing a pointless square.

Turing:

procedure goodBye
    cls
    locate (14, 30)
    put "Thanks for playing"
    locate (15, 30)
    put " you are now exiting"
    loop
        exit
    end loop
end goodBye


What is the point in the loop here, really doesn't look like it is doing anything..
LaZ3R




PostPosted: 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 =)
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 12 Posts ]
Jump to:   


Style:  
Search: