|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xith3d.scenegraph.SceneGraphObject
org.xith3d.scenegraph.Node
org.xith3d.scenegraph.GroupNode
org.xith3d.scenegraph.Group
org.xith3d.scenegraph.TransformGroup
org.xith3d.ui.text2d.Text2D
public class Text2D
As there is no ( or no dynamic ) text node for Xith3D here is mine.
While the Text2D version org.xith3d.text.Text2D by Terje Wiesener uses a single face with a static texture
this class uses a seperate Shape3d for every char it uses. Those shapes are stored in a static HashMap to prevent
some load when using many text objects.
| Field Summary |
|---|
| Fields inherited from class org.xith3d.scenegraph.GroupNode |
|---|
children, hostGroup, numChildren, totalNumChildren, totalNumShapes |
| Fields inherited from class org.xith3d.scenegraph.Node |
|---|
bounds, boundsAutoCompute, boundsDirty, globalIgnoreBounds, instanceBoundsTypeHint, parent, transformGroup, untransformedBounds |
| Fields inherited from class org.xith3d.scenegraph.SceneGraphObject |
|---|
XITH3D_USERDATAKEY_OLDUSERDATA |
| Constructor Summary | |
|---|---|
Text2D(java.lang.String text)
Create a new Text Object with standard Attributes |
|
Text2D(java.lang.String text,
org.openmali.vecmath2.Colorf color)
Creates a new Text2D object |
|
Text2D(java.lang.String text,
org.openmali.vecmath2.Colorf color,
java.awt.Font font,
TextAlignment alignFlags)
Create a new Text Object with all options |
|
Text2D(java.lang.String text,
org.openmali.vecmath2.Colorf color,
java.lang.String fontname,
int fontFlags,
int resolution,
TextAlignment alignFlags)
Create a new Text Object with all options |
|
Text2D(java.lang.String text,
float r,
float g,
float b,
java.awt.Font font,
TextAlignment alignFlags)
Create a new Text Object with all options |
|
Text2D(java.lang.String text,
float r,
float g,
float b,
java.lang.String fontname,
int fontFlags,
int resolution,
TextAlignment alignFlags)
Create a new Text Object with all options |
|
Text2D(java.lang.String text,
TextAlignment alignFlags)
Create a text object with alignflags |
|
| Method Summary | |
|---|---|
TextAlignment |
getAlignment()
|
float |
getBlueValue()
|
org.openmali.vecmath2.Colorf |
getColor()
|
java.awt.Font |
getFont()
|
float |
getGreenValue()
|
java.util.List<Line2D> |
getLines()
|
float |
getRedValue()
|
org.openmali.vecmath2.Tuple2f |
getSize()
|
float |
getTransparency()
|
void |
setAlignment(TextAlignment alignment)
Sets new text alignment. |
void |
setColor(org.openmali.vecmath2.Colorf color)
Sets the color of current text (this should be called after setText if both are called once per frame) |
void |
setColor(float r,
float g,
float b)
Sets the color of current text has a small bug: while changing text rapidly the color doesn't change correctly when setColor is called before setText |
void |
setFont(java.awt.Font font)
Changes/sets the text's font |
void |
setFont(java.lang.String fontname)
Changes/sets the text's font name |
void |
setFontFlags(int fontFlags)
Sets new fontflags @see java.awt.Font. |
void |
setResolution(int resolution)
Sets new resolution. |
void |
setText(java.lang.String newText)
Set new text (this is finally done in an efficient way). |
void |
setTransparency(float transparency)
|
boolean |
update(View view,
org.openmali.spatial.bodies.Frustum frustum,
long nanoTime,
long nanoStep)
|
| Methods inherited from class org.xith3d.scenegraph.TransformGroup |
|---|
getLocalTransform, getLocalTransform, getPosition, getPosition, getTransform, getTransform, getWorldTransform, newInstance, onTransformChanged, setLocalTransform, setPosition, setPosition, setTransform, traverse, updateTransform |
| Methods inherited from class org.xith3d.scenegraph.Group |
|---|
moveTo |
| Methods inherited from class org.xith3d.scenegraph.SceneGraphObject |
|---|
getName, getUserData, getUserData, getUserDataMap, isLive, setLive, setName, setUserData, setUserData, setUserDataRecursive, setUserDataRecursive, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.xith3d.scenegraph.Transformable |
|---|
getName, setName |
| Constructor Detail |
|---|
public Text2D(java.lang.String text,
float r,
float g,
float b,
java.awt.Font font,
TextAlignment alignFlags)
text - the initial text to setr - the foreground color to useg - the foreground color to useb - the foreground color to usefont - the font to use as the font size is fixed on to the texture it's just necessary to give the fontname which can be any font that Font can handlealignFlags - align flags to use
public Text2D(java.lang.String text,
org.openmali.vecmath2.Colorf color,
java.awt.Font font,
TextAlignment alignFlags)
text - the initial text to setfont - the font to use as the font size is fixed on to the texture it's just necessary to give the fontname which can be any font that Font can handlecolor - the foreground color to usealignFlags - align flags to use
public Text2D(java.lang.String text,
float r,
float g,
float b,
java.lang.String fontname,
int fontFlags,
int resolution,
TextAlignment alignFlags)
text - the initial text to setr - the foreground color to useg - the foreground color to useb - the foreground color to usefontname - the font to use as the font size is fixed on to the texture it's just necessary to give the fontname which can be any font that Font can handlefontFlags - font flags to use @see java.awt.Fontresolution - font resolution every letter has a fixed geometry size of 1x1.5. The resolution is the width of the texturealignFlags - align flags to use
public Text2D(java.lang.String text,
org.openmali.vecmath2.Colorf color,
java.lang.String fontname,
int fontFlags,
int resolution,
TextAlignment alignFlags)
text - the initial text to setfontname - the font to use as the font size is fixed on to the texture it's just necessary to give the fontname which can be any font that Font can handlefontFlags - font flags to use @see java.awt.Fontresolution - font resolution every letter has a fixed geometry size of 1x1.5. The resolution is the width of the texturecolor - the foreground color to usealignFlags - align flags to use
public Text2D(java.lang.String text,
org.openmali.vecmath2.Colorf color)
text - new textcolor - color
public Text2D(java.lang.String text,
TextAlignment alignFlags)
text - new textalignFlags - new alignFlagspublic Text2D(java.lang.String text)
text - first Text| Method Detail |
|---|
public java.util.List<Line2D> getLines()
public void setColor(float r,
float g,
float b)
r - red valueg - green valueb - blue valuepublic void setColor(org.openmali.vecmath2.Colorf color)
color - new Color to setsetColor( float, float, float )public org.openmali.vecmath2.Colorf getColor()
public float getRedValue()
public float getBlueValue()
public float getGreenValue()
public void setTransparency(float transparency)
public float getTransparency()
public org.openmali.vecmath2.Tuple2f getSize()
public void setFont(java.awt.Font font)
font - new font to usepublic void setFont(java.lang.String fontname)
fontname - new font to usepublic java.awt.Font getFont()
public void setFontFlags(int fontFlags)
fontFlags - new flagspublic void setResolution(int resolution)
resolution - new resolutionpublic void setAlignment(TextAlignment alignment)
alignment - new text alignmentpublic TextAlignment getAlignment()
public boolean update(View view,
org.openmali.spatial.bodies.Frustum frustum,
long nanoTime,
long nanoStep)
update in interface UpdatableNodeview - the view that's currently used for renderingfrustum - view frustum
public void setText(java.lang.String newText)
newText - new text
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||