Creating Text on a drawing pad
Author |
Message |
cptcool
|
Posted: Tue Mar 25, 2008 1:34 pm Post subject: Creating Text on a drawing pad |
|
|
Hi,
I have been learning Turing for about a month now as a starter program in school. I thought it may be fun creating a little "Connect the dots" game, but I ran into a problem, I dont know how to make the text output from the put command show up on the drawing pad I created. I was wondering if you guys could help me out by telling my where to insert the put command, because when I do it, it appears behind the drawing pad I made. Here is the syntax for my little game so far. (The drawing pad is the white square where u can draw )Thanks in advance.
P.S. I dont know how to make that fancy box to put the syntax code in, so just copy paste this into Turing if you want to test it out .
Import GUI
View.Set ("graphics:300;300,nobuttonbar")
var x1, y1 : int
var drawingpad : int
var clearbutton : int
locate (10,10)
procedure pressdown (x2, y2 : int)
x1 := x2
y1 := y2
end pressdown
procedure MouseDrag (x2, y2 : int)
GUI.DrawLine (drawingpad, x1, y1, x2, y2, 12)
x1 := x2
y1 := y2
end MouseDrag
procedure nothing (x2, y2 : int)
end nothing
procedure clear
GUI.DrawCls (drawingpad)
end clear
drawingpad := GUI.CreateCanvasFull (10, 30, maxx - 20, maxy - 40, 0,
pressdown, MouseDrag, nothing)
clearbutton := GUI.CreateButton (maxx div 2 - 20, 0, 40, "Erase All", clear)
loop
exit when GUI.ProcessEvent
end loop |
|
|
|
|
![](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 25, 2008 2:07 pm Post subject: RE:Creating Text on a drawing pad |
|
|
put is for the text mode. You are really looking for Font.Draw(). Keep in mind that GUI's canvas will redraw itself every so often, so you might have to refresh the text if there's overlap.
The fancy code tags are
[syntax="turing"]
your code here
[/syntax] |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
cptcool
|
Posted: Tue Mar 25, 2008 4:22 pm Post subject: Re: Creating Text on a drawing pad |
|
|
Thanks for replying,but how would I go about putting it in the syntax? can you please show me where to put the text in the command? I tried it a couple of ways but it kept giving me errors ><. Can you give me an example of how I would use it in the syntax I wrote above?
Thanks again |
|
|
|
|
![](images/spacer.gif) |
Mackie
![](http://compsci.ca/v3/uploads/user_avatars/217548454cee912ae1202.png)
|
Posted: Tue Mar 25, 2008 4:49 pm Post subject: RE:Creating Text on a drawing pad |
|
|
It's like this:
code: | Font.Draw("String", x, y, font, color) |
|
|
|
|
|
![](images/spacer.gif) |
cptcool
|
Posted: Tue Mar 25, 2008 5:45 pm Post subject: Re: Creating Text on a drawing pad |
|
|
Thank you for your help.
I'm surprised how fast people replied to my topic... I think I'm going to like this site ![Very Happy Very Happy](http://compsci.ca/v3/images/smiles/icon_biggrin.gif) |
|
|
|
|
![](images/spacer.gif) |
|
|