public class BitmapFontCache
extends java.lang.Object
Constructor and Description |
---|
BitmapFontCache(BitmapFont font) |
BitmapFontCache(BitmapFont font,
boolean integer)
Creates a new BitmapFontCache
|
Modifier and Type | Method and Description |
---|---|
BitmapFont.TextBounds |
addMultiLineText(java.lang.CharSequence str,
float x,
float y)
Adds glyphs for the specified text, which may contain newlines (\n).
|
BitmapFont.TextBounds |
addMultiLineText(java.lang.CharSequence str,
float x,
float y,
float alignmentWidth,
BitmapFont.HAlignment alignment)
Adds glyphs for the specified text, which may contain newlines (\n).
|
BitmapFont.TextBounds |
addText(java.lang.CharSequence str,
float x,
float y)
Adds glyphs for the specified text.
|
BitmapFont.TextBounds |
addText(java.lang.CharSequence str,
float x,
float y,
int start,
int end)
Adds glyphs for the the specified text.
|
BitmapFont.TextBounds |
addWrappedText(java.lang.CharSequence str,
float x,
float y,
float wrapWidth)
Adds glyphs for the specified text, which may contain newlines (\n) and is automatically wrapped within the specified width.
|
BitmapFont.TextBounds |
addWrappedText(java.lang.CharSequence str,
float x,
float y,
float wrapWidth,
BitmapFont.HAlignment alignment)
Adds glyphs for the specified text, which may contain newlines (\n) and is automatically wrapped within the specified width.
|
void |
clear()
Removes all glyphs in the cache.
|
void |
draw(SpriteBatch spriteBatch) |
void |
draw(SpriteBatch spriteBatch,
float alphaModulation) |
void |
draw(SpriteBatch spriteBatch,
int start,
int end) |
BitmapFont.TextBounds |
getBounds()
Returns the size of the cached string.
|
Color |
getColor() |
BitmapFont |
getFont() |
float[] |
getVertices() |
float[] |
getVertices(int page) |
float |
getX()
Returns the x position of the cached string, relative to the position when the string was cached.
|
float |
getY()
Returns the y position of the cached string, relative to the position when the string was cached.
|
void |
setColor(Color tint) |
void |
setColor(Color tint,
int start,
int end)
Sets the color of the specified characters.
|
void |
setColor(float color) |
void |
setColor(float r,
float g,
float b,
float a) |
BitmapFont.TextBounds |
setMultiLineText(java.lang.CharSequence str,
float x,
float y)
Clears any cached glyphs and adds glyphs for the specified text, which may contain newlines (\n).
|
BitmapFont.TextBounds |
setMultiLineText(java.lang.CharSequence str,
float x,
float y,
float alignmentWidth,
BitmapFont.HAlignment alignment)
Clears any cached glyphs and adds glyphs for the specified text, which may contain newlines (\n).
|
void |
setPosition(float x,
float y)
Sets the position of the text, relative to the position when the cached text was created.
|
BitmapFont.TextBounds |
setText(java.lang.CharSequence str,
float x,
float y)
Clears any cached glyphs and adds glyphs for the specified text.
|
BitmapFont.TextBounds |
setText(java.lang.CharSequence str,
float x,
float y,
int start,
int end)
Clears any cached glyphs and adds glyphs for the specified text.
|
void |
setUseIntegerPositions(boolean use)
Specifies whether to use integer positions or not.
|
BitmapFont.TextBounds |
setWrappedText(java.lang.CharSequence str,
float x,
float y,
float wrapWidth)
Clears any cached glyphs and adds glyphs for the specified text, which may contain newlines (\n) and is automatically
wrapped within the specified width.
|
BitmapFont.TextBounds |
setWrappedText(java.lang.CharSequence str,
float x,
float y,
float wrapWidth,
BitmapFont.HAlignment alignment)
Clears any cached glyphs and adds glyphs for the specified text, which may contain newlines (\n) and is automatically
wrapped within the specified width.
|
void |
translate(float xAmount,
float yAmount)
Sets the position of the text, relative to its current position.
|
boolean |
usesIntegerPositions() |
public BitmapFontCache(BitmapFont font)
public BitmapFontCache(BitmapFont font, boolean integer)
font
- the font to useinteger
- whether to use integer positions and sizes.public void setPosition(float x, float y)
x
- The x coordinatey
- The y coodinatepublic void translate(float xAmount, float yAmount)
xAmount
- The amount in x to move the textyAmount
- The amount in y to move the textpublic void setColor(float color)
public void setColor(Color tint)
public void setColor(float r, float g, float b, float a)
public void setColor(Color tint, int start, int end)
setText(CharSequence, float, float)
and
is reset every time setText is called.public void draw(SpriteBatch spriteBatch)
public void draw(SpriteBatch spriteBatch, int start, int end)
public void draw(SpriteBatch spriteBatch, float alphaModulation)
public Color getColor()
public void clear()
public BitmapFont.TextBounds setText(java.lang.CharSequence str, float x, float y)
public BitmapFont.TextBounds setText(java.lang.CharSequence str, float x, float y, int start, int end)
public BitmapFont.TextBounds addText(java.lang.CharSequence str, float x, float y)
public BitmapFont.TextBounds addText(java.lang.CharSequence str, float x, float y, int start, int end)
x
- The x position for the left most character.y
- The y position for the top of most capital letters in the font (the cap height
).start
- The first character of the string to draw.end
- The last character of the string to draw (exclusive).public BitmapFont.TextBounds setMultiLineText(java.lang.CharSequence str, float x, float y)
#addMultiLineText(CharSequence, float, float, float, HAlignment)
public BitmapFont.TextBounds setMultiLineText(java.lang.CharSequence str, float x, float y, float alignmentWidth, BitmapFont.HAlignment alignment)
#addMultiLineText(CharSequence, float, float, float, HAlignment)
public BitmapFont.TextBounds addMultiLineText(java.lang.CharSequence str, float x, float y)
#addMultiLineText(CharSequence, float, float, float, HAlignment)
public BitmapFont.TextBounds addMultiLineText(java.lang.CharSequence str, float x, float y, float alignmentWidth, BitmapFont.HAlignment alignment)
x
- The x position for the left most character.y
- The y position for the top of most capital letters in the font (the cap height
).alignment
- The horizontal alignment of wrapped line.public BitmapFont.TextBounds setWrappedText(java.lang.CharSequence str, float x, float y, float wrapWidth)
#addWrappedText(CharSequence, float, float, float, HAlignment)
public BitmapFont.TextBounds setWrappedText(java.lang.CharSequence str, float x, float y, float wrapWidth, BitmapFont.HAlignment alignment)
#addWrappedText(CharSequence, float, float, float, HAlignment)
public BitmapFont.TextBounds addWrappedText(java.lang.CharSequence str, float x, float y, float wrapWidth)
#addWrappedText(CharSequence, float, float, float, HAlignment)
public BitmapFont.TextBounds addWrappedText(java.lang.CharSequence str, float x, float y, float wrapWidth, BitmapFont.HAlignment alignment)
x
- The x position for the left most character.y
- The y position for the top of most capital letters in the font (the cap height
).alignment
- The horizontal alignment of wrapped line.public BitmapFont.TextBounds getBounds()
cap height
) to the baseline of the last line of text.public float getX()
public float getY()
public BitmapFont getFont()
public void setUseIntegerPositions(boolean use)
use
- public boolean usesIntegerPositions()
public float[] getVertices()
public float[] getVertices(int page)