Package com.jme3.font
Class BitmapText
java.lang.Object
com.jme3.scene.Spatial
com.jme3.scene.Node
com.jme3.font.BitmapText
- All Implemented Interfaces:
HasLocalTransform
,CloneableSmartAsset
,Collidable
,Savable
,JmeCloneable
,Cloneable
-
Nested Class Summary
Nested classes/interfaces inherited from class com.jme3.scene.Spatial
Spatial.BatchHint, Spatial.CullHint, Spatial.DFSMode
-
Field Summary
Fields inherited from class com.jme3.scene.Spatial
batchHint, controls, cullHint, frustrumIntersects, key, localLights, localOverrides, localTransform, name, parent, queueBucket, queueDistance, refreshFlags, RF_BOUND, RF_CHILD_LIGHTLIST, RF_LIGHTLIST, RF_MATPARAM_OVERRIDE, RF_TRANSFORM, shadowMode, userData, worldBound, worldLights, worldOverrides, worldTransform
-
Constructor Summary
ConstructorDescriptionBitmapText
(BitmapFont font) BitmapText
(BitmapFont font, boolean rightToLeft) Deprecated.The "rightToLeft" flag should be specified in the font.BitmapText
(BitmapFont font, boolean rightToLeft, boolean arrayBased) -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates a clone of the asset.void
cloneFields
(Cloner cloner, Object original) Called internally by com.jme3.util.clone.Cloner.float
getAlpha()
getColor()
getFont()
float
int
float
float
float
getSize()
getText()
void
render
(RenderManager rm, ColorRGBA color) void
setAlignment
(BitmapFont.Align align) Set horizontal alignment.void
setAlpha
(float alpha) Sets an overall alpha that will be applied to all letters.void
Define the area where the BitmapText will be rendered.void
Set the color of substring.void
changes text color.void
Set the color of substring.void
setEllipsisChar
(char c) for setLineWrapType(LineWrapType.NoWrap), set the last character when the text exceeds the bound.void
setLineWrapMode
(LineWrapMode wrap) Available only when bounding is set.void
setSize
(float size) Changes text sizevoid
setStyle
(int start, int end, int style) Set the font style of substring.void
Set the font style of substring.void
setTabPosition
(float... tabs) void
setTabWidth
(float width) used for the tabs over the last tab position.void
setText
(CharSequence text) void
void
Set vertical alignment.void
updateLogicalState
(float tpf) updateLogicalState
calls theupdate()
method for all controls attached to this Spatial.Methods inherited from class com.jme3.scene.Node
attachChild, attachChildAt, breadthFirstTraversal, clone, collideWith, deepClone, depthFirstTraversal, descendantMatches, descendantMatches, descendantMatches, detachAllChildren, detachChild, detachChildAt, detachChildNamed, getChild, getChild, getChildIndex, getChildren, getQuantity, getTriangleCount, getVertexCount, hasChild, oldDeepClone, read, setLightListRefresh, setLodLevel, setMaterial, setMatParamOverrideRefresh, setModelBound, setParent, setTransformRefresh, swapChildren, updateGeometricState, updateModelBound, updateWorldBound, write
Methods inherited from class com.jme3.scene.Spatial
addControl, addControlAt, addLight, addMatParamOverride, breadthFirstTraversal, center, checkCulling, clearMatParamOverrides, depthFirstTraversal, forceRefresh, getBatchHint, getControl, getControl, getCullHint, getKey, getLastFrustumIntersection, getLocalBatchHint, getLocalCullHint, getLocalLightList, getLocalMatParamOverrides, getLocalQueueBucket, getLocalRotation, getLocalScale, getLocalShadowMode, getLocalToWorldMatrix, getLocalTransform, getLocalTranslation, getName, getNumControls, getParent, getQueueBucket, getShadowMode, getUserData, getUserDataKeys, getWorldBound, getWorldLightList, getWorldMatParamOverrides, getWorldRotation, getWorldScale, getWorldTransform, getWorldTranslation, hasAncestor, jmeClone, localToWorld, lookAt, matches, move, move, oldClone, removeControl, removeControl, removeFromParent, removeLight, removeMatParamOverride, rotate, rotate, rotateUpTo, runControlRender, scale, scale, setBatchHint, setBoundRefresh, setCullHint, setKey, setLastFrustumIntersection, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalScale, setLocalTransform, setLocalTranslation, setLocalTranslation, setName, setQueueBucket, setRequiresUpdates, setShadowMode, setUserData, toString, updateMatParamOverrides, updateWorldLightList, updateWorldTransforms, worldToLocal
-
Constructor Details
-
BitmapText
-
BitmapText
Deprecated.The "rightToLeft" flag should be specified in the font. UseBitmapText(com.jme3.font.BitmapFont)
- Parameters:
font
- the font to use (not null, alias created)rightToLeft
- true → right-to-left, false → left-to-right (default=false)
-
BitmapText
-
-
Method Details
-
clone
Description copied from interface:CloneableSmartAsset
Creates a clone of the asset. Please seeObject.clone()
for more info on how this method should be implemented.- Specified by:
clone
in interfaceCloneableSmartAsset
- Overrides:
clone
in classSpatial
- Returns:
- A clone of this Spatial, the scene graph in its entirety is cloned and can be altered independently of the original scene graph. Note that meshes of geometries are not cloned explicitly, they are shared if static, or specially cloned if animated.
- See Also:
-
cloneFields
Called internally by com.jme3.util.clone.Cloner. Do not call directly.- Specified by:
cloneFields
in interfaceJmeCloneable
- Overrides:
cloneFields
in classNode
- Parameters:
cloner
- The cloner that is performing the cloning operation. The cloneFields method can call back into the cloner to make clones of its subordinate fields.original
- The original object from which this object was cloned. This is provided for the very rare case that this object needs to refer to its original for some reason. In general, all of the relevant values should have been transferred during the shallow clone, and this object need only clone what it wants.
-
getFont
-
setSize
public void setSize(float size) Changes text size- Parameters:
size
- text size
-
getSize
public float getSize() -
setText
- Parameters:
text
- charsequence to change text to
-
setText
- Parameters:
text
- String to change text to
-
getText
- Returns:
- returns text
-
getColor
- Returns:
- color of the text
-
setColor
changes text color. all substring colors are deleted.- Parameters:
color
- new color of text
-
setAlpha
public void setAlpha(float alpha) Sets an overall alpha that will be applied to all letters. If the alpha passed is -1 then alpha reverts to default... which will be 1 for anything unspecified and color tags will be reset to 1 or their encoded alpha.- Parameters:
alpha
- the desired alpha, or -1 to revert to the default
-
getAlpha
public float getAlpha() -
setBox
Define the area where the BitmapText will be rendered.- Parameters:
rect
- position and size box where text is rendered
-
getLineHeight
public float getLineHeight()- Returns:
- height of the line
-
getHeight
public float getHeight()- Returns:
- height of whole text block
-
getLineWidth
public float getLineWidth()- Returns:
- width of line
-
getLineCount
public int getLineCount()- Returns:
- line count
-
getLineWrapMode
-
setAlignment
Set horizontal alignment. Applicable only when text bound is set.- Parameters:
align
- the desired alignment (such as Align.Left)
-
setVerticalAlignment
Set vertical alignment. Applicable only when text bound is set.- Parameters:
align
- the desired alignment (such as Align.Top)
-
getAlignment
-
getVerticalAlignment
-
setStyle
public void setStyle(int start, int end, int style) Set the font style of substring. If font doesn't contain style, default style is used- Parameters:
start
- start index to set style. inclusive.end
- end index to set style. EXCLUSIVE.style
- the style to apply
-
setStyle
Set the font style of substring. If font doesn't contain style, default style is applied- Parameters:
regexp
- regular expressionstyle
- the style to apply
-
setColor
Set the color of substring.- Parameters:
start
- start index to set style. inclusive.end
- end index to set style. EXCLUSIVE.color
- the desired color
-
setColor
Set the color of substring.- Parameters:
regexp
- regular expressioncolor
- the desired color
-
setTabPosition
public void setTabPosition(float... tabs) - Parameters:
tabs
- tab positions
-
setTabWidth
public void setTabWidth(float width) used for the tabs over the last tab position.- Parameters:
width
- tab size
-
setEllipsisChar
public void setEllipsisChar(char c) for setLineWrapType(LineWrapType.NoWrap), set the last character when the text exceeds the bound.- Parameters:
c
- the character to indicate truncated text
-
setLineWrapMode
Available only when bounding is set.setBox()
method call is needed in advance. true when- Parameters:
wrap
- NoWrap : Letters over the text bound is not shown. the last character is set to '...'(0x2026) Character: Character is split at the end of the line. Word : Word is split at the end of the line. Clip : The text is hard-clipped at the border including showing only a partial letter if it goes beyond the text bound.
-
updateLogicalState
public void updateLogicalState(float tpf) Description copied from class:Spatial
updateLogicalState
calls theupdate()
method for all controls attached to this Spatial.- Overrides:
updateLogicalState
in classNode
- Parameters:
tpf
- Time per frame.- See Also:
-
render
-