Adding text
The game object also defines the addText(id,con,pos,col) method. Id works as always, con is the string to write, pos is like a "text box" in which the string is written, and col is the color of the text (not the background). Like addRect, the object is returned.

Properties of the text object
id, animating, depth, color and position work as always. Functions for movement, animation, deletion and events are exactly the same as they are for the rectangle. However, the text object has some additional properties.
The isCentre property is used to centre the text. The hasHeight property sets wether or not LDK should specify a height for the layer. The tStyle object is a property of the text object and contains some additional style information. tStyle.bold sets wether or not the font should be rendered bold - similarily, tStyle.italic sets wether it should be rendered in italics. As the position property has no bearing on the size of the text, tStyle.size sets the size of the text in points (the default method of sizing text in most text editors). tStyle.fontFamily can be used to specify a custom font family.
Changing these properties by themselves still has no effect. You also need to call the update() method after your changes have been made.

Last edited Dec 13, 2009 at 10:34 PM by larztheloser, version 1

Comments

No comments yet.