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

Username:   Password: 
 RegisterRegister   
 Creating Text on a drawing pad
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
cptcool




PostPosted: 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 Smile )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 Smile .



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




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




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

Turing:




Thanks again
Mackie




PostPosted: 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)
cptcool




PostPosted: 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
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  [ 5 Posts ]
Jump to:   


Style:  
Search: