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

Username:   Password: 
 RegisterRegister   
 Font Draw
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Joe Keller




PostPosted: Fri Jan 20, 2012 8:39 pm   Post subject: Font Draw

What is it you are trying to achieve?
I want to draw the font with the product number (im making the price is right game),
i will be like
Product 1
then show it, and so on

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Turing:


var productnumb := 0

loop
productnumb:= productnumb + 1
var font8 : int
    font8 := Font.New ("Arial:20")
Font.Draw ("Product" productnumb, 230, 381, font8, 7) %I want to put the number of the product, and not have to manually type product one, product two, product 3
exit when productnumb = 3
end loop


Sponsor
Sponsor
Sponsor
sponsor
Alex C.




PostPosted: Fri Jan 20, 2012 8:59 pm   Post subject: RE:Font Draw

well your produc tnumber is an int, and Font.Draw can only accept string and char types of variable...

look into your holtsoft doc to find the convert "int to string" command
Joe Keller




PostPosted: Fri Jan 20, 2012 9:02 pm   Post subject: RE:Font Draw

Is there any other way of doing it than this specific code? so i can write a number i can alter aswell as text
Alex C.




PostPosted: Fri Jan 20, 2012 9:09 pm   Post subject: RE:Font Draw

mmmmm.... im not sure
Dreadnought




PostPosted: Sat Jan 21, 2012 12:38 am   Post subject: Re: Font Draw

I think
Joe Keller wrote:
Is there any other way of doing it than this specific code? so i can write a number i can alter aswell as text

I think you want to have both text and a variable together in the string you draw. This is very easy once you convert the integer (product) into a string.

You just do regular string concatenation.
Turing:
Font.Draw (string1 + string2 + etc. , /* other arguments*/)
% In your case
Font.Draw ("Product" + <insert function to convert integer to string> (product), 230, 381, font8, 7)


I'm gonna stick with Alex C.'s idea of not telling you the name of the function to convert an integer into a string, but I'll give you hint, it starts with "int" (just the letters not the quotation marks).

Good luck.
copthesaint




PostPosted: Sat Jan 21, 2012 10:03 am   Post subject: RE:Font Draw

This results int to string
Turing:
intstr (: int) : string

this results string to int
Turing:
strint (s : string) : int

this results real to string
Turing:
realstr (x : real, 0) : string
Alex C.




PostPosted: Sat Jan 21, 2012 2:30 pm   Post subject: RE:Font Draw

@Dreadnought

Hey! i actually forgot that function!
your soul shall burn forever!!! Evil or Very Mad
just kidding! lol Razz
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  [ 7 Posts ]
Jump to:   


Style:  
Search: