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

Username:   Password: 
 RegisterRegister   
 Using variables as text in Font.Draw
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
14fenix




PostPosted: Sat Dec 06, 2003 8:12 pm   Post subject: Using variables as text in Font.Draw

Im making a "Kids Program" that helps teach kids how to add/multiply/etc...

Anyways.. Im trying to avoid using simple put statements and am using Font.Draw I want my code to generate random numbers, and then ask what the two numbers equal when added... The problem is, im trying to combine variables and text in the section of the Font.Draw command where you input your text..

Heres a simplified version of my code:

code:


var FontID1 : int := Font.New ("sanserif:20:bold")
var add1a := Rand.Int (0, 10)
var add1b := Rand.Int (0, 10)
Font.Draw (" What does ", add1a, "  plus  ", add1b, " equal?", 200, 200, FontID1, 7)



Do you guys see my problem?? Commas are used to divide arguments but im trying to use them to divide vars from my text.. How can I work around this??

Thanks
Sponsor
Sponsor
Sponsor
sponsor
AsianSensation




PostPosted: Sat Dec 06, 2003 8:28 pm   Post subject: (No subject)

use intstr to convert the integers to strings, then concatenate.

code:
Font.Draw ("What does " + intstr (add1a) + " plus " + intstr (add1b) + " equal?", 200, 200, FontID1, 7)
14fenix




PostPosted: Sat Dec 06, 2003 9:01 pm   Post subject: (No subject)

Sweet thanks. I was looking at the intstr command too but wasnt too aware of what it does
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  [ 3 Posts ]
Jump to:   


Style:  
Search: