Text3D Classes (Updated 04/01/2006)
by Lo Saeteurn (lo at miensoftware dot com)
Mien Software
www.miensoftware.com
These classes allow you to easily implement text into your RB3D
programs! Sample project file included along with a simple text style
generator. Please give me feedback or optimization advise.
Download:
http://www.miensoftware.com/files/rb/text3dclassbeta.zip
Known Issue:
Currently only wraps characters rather than words
-----------------------------------------------------
It is very easy to use: just load all the characters first, then call
Text3DManager.build. You can create the Text3D objects like this:
myText3D =new Text3D(text as string, [textStyle as TextStyle3D] ,
[wrapWidth as integer])
Here is how to do multiple styles in one Text3D object:
myText3D.style=Text3DManager.GetTextStyle("myStyleType1")
myText3D.setText "This is one style."+chr(13)
myText3D.style=Text3DManager.GetTextStyle("myStyleType2")
myText3D.append "Here is another style."
Features:
- supports multiple styles (can be mixed using the append method)
- supports multiple lines
- supports text wrapping
- change text dynamically
- overlaying the text onto the screen
-----------------------------------------------------
Text3D
Constructors:
Text3D(text as string, textstyle as Text3DStyle, [wrapWidth as integer])
Text3D(text as string, [wrapWidth as integer]) //the default text
style will be used
Properties:
Scale as double //the scale in world space
OverlayScale as double //the scale when it is overlayed on the viewer/
screen
Left as integer //the x position (in pixels) when it is overlayed on
the viewer/screen
Top as integer //the y position (in pixels) when it is overlayed on
the viewer/screen
Width as integer //the width (in pixels) of the Text3D object
Height as integer //the height (in pixels) of the Text3D object
WrapWidth as integer //the width (in pixels) to wrap to a new line
TextStyle as TextStyle3D //the current style to use when setting or
appending new text
Methods:
GetText as string //returns the text value of the Text3D object
SetText(text as string) //fills the Text3D object with the passed
string using the current TextStyle
AppendText(text as string) //adds the passed string to the end of the
Text3D object using the current TextStyle
UpdateOverlay(viewer as Rb3DSpace) //overlays the Text3D object over
viewer/screen using its top/left properties
Text3DManager
Methods:
Register(f as folderitem, key as string, StyleName as string) //
registers the passed image file into the specified text style with
the specified key/character
Register(p as picture, key as string, StyleName as string) //
registers the passed image into the specified text style with the
specified key/character
Build() //should be called after registering all the keys and before
creating any Text3D object
GetTextStyle([styleName as string]) as Text3DStyle //returns the
Text3DStyle with the specified name; passing an empty parameter
returns the default Text3DStyle
SetDefaultStyle(textStyle as Text3DStyle) //sets the passed
Text3DStyle as the default text style
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|