Package com.ardor3d.ui.text
Class BMTextBackground
java.lang.Object
com.ardor3d.scenegraph.Spatial
com.ardor3d.scenegraph.Mesh
com.ardor3d.ui.text.BMTextBackground
- All Implemented Interfaces:
Pickable
,Hintable
,Renderable
,BMTextChangeListener
,Savable
A 9-slice capable background, suitable for sitting behind BMText to increase readability.
-
Field Summary
Fields inherited from class com.ardor3d.scenegraph.Mesh
_defaultColor, _isVisible, _lightState, _meshData, _modelBound, _states, RENDER_VERTEX_ONLY
Fields inherited from class com.ardor3d.scenegraph.Spatial
_controllers, _delegateMap, _dirtyMark, _frustumIntersects, _listener, _localTransform, _name, _parent, _queueDistance, _renderStateList, _sceneHints, _userData, _worldBound, _worldTransform, ON_DIRTY_ATTACHED, ON_DIRTY_BOUNDING, ON_DIRTY_RENDERSTATE, ON_DIRTY_TRANSFORM, ON_DIRTY_TRANSFORM_ONLY
-
Constructor Summary
ConstructorDescriptionBMTextBackground
(String name, BMText text, Texture texture) BMTextBackground
(String name, BMText text, Texture texture, ReadOnlyVector4 textureBorderOffsets) -
Method Summary
Modifier and TypeMethodDescriptionvoid
draw
abstract method that handles drawing data to the renderer if it is geometry and passing the call to it's children if it is a node.float
Class
<? extends BMTextBackground> void
read
(InputCapsule capsule) void
void
setBorderScale
(float scale) Sets the scale of the 9 slice border texture.void
setContentPadding
(float padding) Set internal padding between text and border.void
setContentPadding
(float x, float y, float z, float w) Set internal padding between text and border.void
setContentPadding
(ReadOnlyVector4 padding) Set internal padding between text and border.void
setTexBorderOffsets
(float offset) Set the amount of texture uv space to reserve for the border for all sides to the same value.void
setTexBorderOffsets
(float x, float y, float z, float w) void
setTexBorderOffsets
(ReadOnlyVector4 offsets) Splits up the texture drawn on this background into a grid. x,y,z, and w of the given vector are interpreted as the u/v coordinate offset from the left, top, right and bottom edges of the texture respectively.void
textAlphaChanged
(BMText text, float alpha) void
textSizeChanged
(BMText text, ReadOnlyVector2 size) void
write
(OutputCapsule capsule) Methods inherited from class com.ardor3d.scenegraph.Mesh
applyWorldRenderStates, getDefaultColor, getLightState, getMeshData, getModelBound, getModelBound, getWorldNormals, getWorldRenderState, getWorldVectors, intersectsPrimitivesWhere, intersectsWorldBound, intersectsWorldBoundsWhere, isVisible, makeCopy, makeInstanced, render, render, renderArrays, renderVBO, reorderIndices, reorderVertexData, reorderVertexData, setDefaultColor, setDefaultColor, setLightState, setMeshData, setModelBound, setModelBound, setRandomColors, setSolidColor, setVisible, sortLights, supportsBoundsIntersectionRecord, supportsPrimitivesIntersectionRecord, updateModelBound, updateWorldBound
Methods inherited from class com.ardor3d.scenegraph.Spatial
acceptVisitor, addController, addTranslation, addTranslation, clearControllers, clearDirty, clearDirty, clearRenderState, getController, getControllerCount, getControllers, getCurrentRenderDelegate, getLastFrustumIntersection, getListener, getLocalLastFrustumIntersection, getLocalRenderState, getLocalRenderStates, getName, getParent, getParentHintable, getRenderDelegate, getRotation, getScale, getSceneHints, getTransform, getTranslation, getUserData, getWorldBound, getWorldRotation, getWorldScale, getWorldTransform, getWorldTranslation, hasAncestor, isDirty, localToWorld, markDirty, markDirty, onDraw, propagateBoundToRoot, propagateDirtyDown, propagateDirtyUp, propagateStatesFromRoot, propageEventUp, removeController, removeController, removeFromParent, setLastFrustumIntersection, setListener, setName, setParent, setRenderDelegate, setRenderState, setRotation, setRotation, setScale, setScale, setScale, setTransform, setTranslation, setTranslation, setUserData, setWorldRotation, setWorldRotation, setWorldScale, setWorldScale, setWorldScale, setWorldTransform, setWorldTranslation, setWorldTranslation, toString, updateChildren, updateControllers, updateGeometricState, updateGeometricState, updateWorldRenderStates, updateWorldRenderStates, updateWorldTransform, worldToLocal
-
Constructor Details
-
BMTextBackground
-
BMTextBackground
public BMTextBackground(String name, BMText text, Texture texture, ReadOnlyVector4 textureBorderOffsets)
-
-
Method Details
-
setBackgroundColor
-
setBorderScale
public void setBorderScale(float scale) Sets the scale of the 9 slice border texture. By default this is set to 1 meaning we attempt to make it pixel perfect. If the source texture is too large or small, leading to an undesired border size, changing this value will adjust the border without scaling other transform values.- Parameters:
scale
- the scale
-
getBorderScale
public float getBorderScale() -
setTexBorderOffsets
Splits up the texture drawn on this background into a grid. x,y,z, and w of the given vector are interpreted as the u/v coordinate offset from the left, top, right and bottom edges of the texture respectively. This forms a 9 slice/patch grid. The edges of the grid are stretched along their given axis to fit. The corners are presented without stretching their natural ratio. The center patch is stretched to fit on both axis. The default value is (.25, .25, .25, .25) which reserves a 25% border around the center content.- Parameters:
offsets
- the offsets
-
setTexBorderOffsets
public void setTexBorderOffsets(float offset) Set the amount of texture uv space to reserve for the border for all sides to the same value.- Parameters:
offset
- the offset
-
setTexBorderOffsets
public void setTexBorderOffsets(float x, float y, float z, float w) -
getTexBorderOffsets
-
setContentPadding
Set internal padding between text and border.- Parameters:
padding
- the padding
-
setContentPadding
public void setContentPadding(float padding) Set internal padding between text and border.- Parameters:
padding
- the padding
-
setContentPadding
public void setContentPadding(float x, float y, float z, float w) Set internal padding between text and border.- Parameters:
x
- the x valuey
- the y valuez
- the z valuew
- the w value
-
getContentPadding
-
draw
Description copied from class:Spatial
draw
abstract method that handles drawing data to the renderer if it is geometry and passing the call to it's children if it is a node. -
textSizeChanged
- Specified by:
textSizeChanged
in interfaceBMTextChangeListener
-
textAlphaChanged
- Specified by:
textAlphaChanged
in interfaceBMTextChangeListener
-
getClassTag
- Specified by:
getClassTag
in interfaceSavable
- Overrides:
getClassTag
in classMesh
- See Also:
-
write
- Specified by:
write
in interfaceSavable
- Overrides:
write
in classMesh
- Parameters:
capsule
- the capsule- Throws:
IOException
- Signals that an I/O exception has occurred.- See Also:
-
read
- Specified by:
read
in interfaceSavable
- Overrides:
read
in classMesh
- Parameters:
capsule
- the input capsule- Throws:
IOException
- Signals that an I/O exception has occurred.- See Also:
-