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

Username:   Password: 
 RegisterRegister   
 Using Variables with Font.Draw
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
seawad_




PostPosted: Tue Oct 21, 2014 7:48 pm   Post subject: Using Variables with Font.Draw

I can't figure out how to make variables work with Font.New
Please heal or post a code.

var font := Font.New ("Times New Roman:30")
var ps : int

Font.Draw (ps,x,y,font,colour)

I want to make it so it displays ps (player score)

Thank you
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Tue Oct 21, 2014 7:57 pm   Post subject: RE:Using Variables with Font.Draw

The first parameter in the procedure Font.Draw is of the string type. You can convert an integer to a string by using the intstr function.

Turing:

var number : int := 0

% Example of converting an integer to a string and storing it as a variable.
var text : string := "1"
text := intstr(number)

% Example of converting an integer to a string and combining it with another string before rendering it using a font & color.
Font.Draw("Score: " + intstr(number), x, y, fontId, colorId)
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  [ 2 Posts ]
Jump to:   


Style:  
Search: