Need help with 'Click to continue' code
Author |
Message |
MrC
|
Posted: Tue Mar 30, 2010 4:34 pm Post subject: Need help with 'Click to continue' code |
|
|
Hello,
I am writing a game with Turing 4.1. I'm a compsci teacher, and doing this for my own enrichment ...
My program starts by drawing some graphics. Next, I attempt to draw a canvas over the existing graphics. Everything works fine ... Until I tried to create a "click to continue" portion of code.
The program flow gets all messed up. Even though the loop that waits for a mouse click is at the very end of my program, it stops the drawing partway through and only continues after I click. The click is currently the last part of the program, so I can't figure out why this is happening. I can't paste my whole code because it involves importing graphics and maps from files, but I'll post the jist of the problem:
% draw graphics
% create a GUI.Canvas and display it
% Draw some text into the canvas, including "click to continue"
View.Update
loop
Mouse.Where(x, y, b)
exit when b = 1
end loop
When I remove the mouse command everything is drawn perfectly. When I put it back in, it stops drawing part way through and only finishes the drawing after I click. It just doesn't make sense! HELP please!! ![Smile Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Tue Mar 30, 2010 5:14 pm Post subject: RE:Need help with \'Click to continue\' code |
|
|
The code sample doesn't demonstrate the described problem.
Also, we have [ syntax="turing" ] tags to paste code into. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
MrC
|
Posted: Tue Mar 30, 2010 5:18 pm Post subject: RE:Need help with \'Click to continue\' code |
|
|
I fixed it. Here is the code that works:
Turing: | font1 := Font.New ("Times New Roman:14:bold,italic")
font2 := Font.New ("Times New Roman:10")
font3 := Font.New ("Arial:10")
GUI.Show (canvas )
GUI.FontDraw (canvas, "Welcome to Drakefield Legend", 5, 160, font1, green)
GUI.FontDraw (canvas, "A Game by Jordan Cohen", 5, 145, font2, black)
GUI.FontDraw (canvas, "Click to Continue", 75, 35, font3, grey)
View.Update
loop
Mouse.Where (x, y, b )
exit when b = 1
end loop
|
Seems to work well. "canvas" is a pre-defined GUI canvas. |
|
|
|
|
![](images/spacer.gif) |
USEC_OFFICER
![](http://compsci.ca/v3/uploads/user_avatars/16624966004bb548179e82e.png)
|
Posted: Tue Mar 30, 2010 6:45 pm Post subject: RE:Need help with \'Click to continue\' code |
|
|
I don't see the difference between the two bits of code. (The important bits) However since the problem is solved, I hope your game turns out well. |
|
|
|
|
![](images/spacer.gif) |
Euphoracle
![](http://compsci.ca/v3/uploads/user_avatars/11170373664bf5f25f636f1.png)
|
Posted: Tue Mar 30, 2010 7:14 pm Post subject: RE:Need help with \'Click to continue\' code |
|
|
Look into Input.Pause. |
|
|
|
|
![](images/spacer.gif) |
MrC
|
Posted: Wed Mar 31, 2010 7:14 pm Post subject: Re: RE:Need help with \'Click to continue\' code |
|
|
Euphoracle @ Tue Mar 30, 2010 7:14 pm wrote: Look into Input.Pause.
I'll check that out, thansk for the tip.
Oh and I realize now that my question was in fact very unclear I was frustrated ... but it turned out to be a View.Update issue.
I'll post the game when (if ever) it is complete ![Smile Smile](images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
USEC_OFFICER
![](http://compsci.ca/v3/uploads/user_avatars/16624966004bb548179e82e.png)
|
Posted: Wed Mar 31, 2010 7:41 pm Post subject: RE:Need help with \'Click to continue\' code |
|
|
Now I am even more confused. But still looking forward to it. |
|
|
|
|
![](images/spacer.gif) |
|
|