com.jmex.angelfont
Class BitmapText

java.lang.Object
  extended by com.jme.scene.Spatial
      extended by com.jme.scene.Geometry
          extended by com.jme.scene.TriMesh
              extended by com.jmex.angelfont.BitmapText
All Implemented Interfaces:
Savable, java.io.Serializable

public class BitmapText
extends TriMesh

BitmapText represents a block of characters. The looks of the BitmapText are defined by the BitmapFont from which the text was created. A BitmapText can be restricted by a Rectangle and will be wrapped accordingly. If no Rectangle is defined, the text will not be restricted and not wrapped. After setting up the text and after every change, the method update() has to be invoked. This will recreate the text and assemble the various characters into one TriMesh. For more info about the various Parameters of the Text, look at the JavaDoc of the setter methods.

Author:
dhdd, Andreas Grabner, Momoko_Fan (enhancements)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jme.scene.TriMesh
TriMesh.Mode
 
Nested classes/interfaces inherited from class com.jme.scene.Spatial
Spatial.CullHint, Spatial.LightCombineMode, Spatial.NormalsMode, Spatial.TextureCombineMode
 
Field Summary
 
Fields inherited from class com.jme.scene.TriMesh
indexBuffer, mode, triangleQuantity
 
Fields inherited from class com.jme.scene.Geometry
binormalBuf, bound, castsShadows, colorBuf, compVect, defaultColor, displayListID, enabled, fogBuf, hasDirtyVertices, normBuf, states, tangentBuf, texBuf, vboInfo, vertBuf, vertQuantity
 
Fields inherited from class com.jme.scene.Spatial
collisionBits, cullHint, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, lockedMode, name, normalsMode, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder
 
Constructor Summary
BitmapText(BitmapFont font, boolean rightToLeft)
          Constructor sets up and initializes the text with zero length
 
Method Summary
 float getLineHeight()
           
 float getLineWidth()
           
 void setAlignment(BitmapFont.Align alignment)
          Set the alignment of the Text at point 0 on the X-axis
 void setBox(Rectangle rect)
          Set a restricting Rectangle
 void setSize(float size)
          Set the size of the BitmapText
 void setText(java.lang.String text)
          Set the text content of the BitmapText
 void setUseKerning(boolean kerning)
          Set kerning mode
 void update()
          Updates the BitmapText and merges the multiple characters, represented by FontQuads into one TriMesh
 
Methods inherited from class com.jme.scene.TriMesh
clearBuffers, draw, findCollisions, findTriangleCollision, findTrianglePick, getIndexBuffer, getMaxIndex, getMeshAsTriangles, getMeshAsTrianglesVertices, getMode, getTriangle, getTriangle, getTriangleCount, getTriangleIndices, getVertIndex, hasCollision, hasTriangleCollision, hasTriangleCollision, randomPointOnTriangles, read, recalcTriangleQuantity, reconstruct, setIndexBuffer, setMode, setTriangleQuantity, write
 
Methods inherited from class com.jme.scene.Geometry
addTextureCoordinates, addTextureCoordinates, applyRenderState, checkTextureCoordinates, clearTextureBuffers, copyTextureCoordinates, copyTextureCoordinates, findPick, getBinormalBuffer, getColorBuffer, getDefaultColor, getDisplayListID, getFogBuffer, getLightState, getModelBound, getNormalBuffer, getNumberOfUnits, getTangentBuffer, getTextureCoords, getTextureCoords, getVBOInfo, getVertexBuffer, getVertexCount, getWorldCoords, getWorldNormals, hasDirtyVertices, isCastsShadows, lockMeshes, postdraw, predraw, randomVertex, reconstruct, resizeTextureIds, rotateNormals, rotatePoints, scaleTextureCoordinates, scaleTextureCoordinates, setBinormalBuffer, setCastsShadows, setColorBuffer, setDefaultColor, setDisplayListID, setFogCoordBuffer, setHasDirtyVertices, setLightState, setModelBound, setNormalBuffer, setRandomColors, setSolidColor, setTangentBuffer, setTextureCoords, setTextureCoords, setTextureCoords, setVBOInfo, setVertexBuffer, setVertexCount, sortLights, translatePoints, translatePoints, unlockMeshes, updateModelBound, updateWorldBound
 
Methods inherited from class com.jme.scene.Spatial
addController, calculateCollisions, calculateCollisions, calculatePick, calculatePick, clearControllers, clearRenderState, clearRenderState, findCollisions, findPick, getClassTag, getCollisionMask, getController, getControllerCount, getControllers, getCullHint, getLastFrustumIntersection, getLightCombineMode, getLocalCullHint, getLocalLightCombineMode, getLocalNormalsMode, getLocalRenderQueueMode, getLocalRotation, getLocalScale, getLocalTextureCombineMode, getLocalToWorldMatrix, getLocalTranslation, getLocks, getName, getNormalsMode, getParent, getRenderQueueMode, getRenderState, getRenderState, getTextureCombineMode, getUserData, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, hasAncestor, hasCollision, isCollidable, isCollidable, localToWorld, lock, lock, lockBounds, lockBranch, lockMeshes, lockShadows, lockTransforms, lookAt, matches, matches, onDraw, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeController, removeFromParent, removeUserData, rotateUpTo, setCollisionMask, setCullHint, setIsCollidable, setLastFrustumIntersection, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setLocalTranslation, setLocks, setLocks, setName, setNormalsMode, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setUserData, setZOrder, setZOrder, toString, unlock, unlock, unlockBounds, unlockBranch, unlockMeshes, unlockShadows, unlockTransforms, updateGeometricState, updateRenderState, updateRenderState, updateWorldData, updateWorldRotation, updateWorldScale, updateWorldTranslation, updateWorldVectors, updateWorldVectors, worldToLocal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jme.util.export.Savable
getClassTag
 

Constructor Detail

BitmapText

public BitmapText(BitmapFont font,
                  boolean rightToLeft)
Constructor sets up and initializes the text with zero length

Parameters:
font - the BitmapFont from which to create the text
rightToLeft - option for writing from the right to the left side. e.g. Chinese
Method Detail

update

public void update()
Updates the BitmapText and merges the multiple characters, represented by FontQuads into one TriMesh


setSize

public void setSize(float size)
Set the size of the BitmapText

Parameters:
size - the size of one line of the BitmapText in pixels

setText

public void setText(java.lang.String text)
Set the text content of the BitmapText

Parameters:
text - the content the BitmapText is to show

setBox

public void setBox(Rectangle rect)
Set a restricting Rectangle

Parameters:
rect - the Rectangle that restricts the text and in which the text will be wrapped accordingly

setUseKerning

public void setUseKerning(boolean kerning)
Set kerning mode

Parameters:
kerning - lets the BitmapText class use kerning, as defined here: http://en.wikipedia.org/wiki/Kerning

setAlignment

public void setAlignment(BitmapFont.Align alignment)
Set the alignment of the Text at point 0 on the X-axis

Parameters:
alignment - Either BitmapFont.Align.Center, BitmapFont.Align.Left or BitmapFont.Align.Right BitmapFont.Align.Left is set as default.

getLineHeight

public float getLineHeight()

getLineWidth

public float getLineWidth()


Copyright 2003-2009 jMonkeyEngine