
-----------------------------------
cptcool
Tue Mar 25, 2008 1:34 pm

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

-----------------------------------
Tony
Tue Mar 25, 2008 2:07 pm

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]

-----------------------------------
cptcool
Tue Mar 25, 2008 4:22 pm

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 >