public class BitmapFontCache extends 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(CharSequence str,
float x,
float y)
Adds glyphs for the specified text, which may contain newlines (\n).
|
BitmapFont.TextBounds |
addMultiLineText(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(CharSequence str,
float x,
float y)
Adds glyphs for the specified text.
|
BitmapFont.TextBounds |
addText(CharSequence str,
float x,
float y,
int start,
int end)
Adds glyphs for the the specified text.
|
BitmapFont.TextBounds |
addWrappedText(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(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(Batch spriteBatch) |
void |
draw(Batch spriteBatch,
float alphaModulation) |
void |
draw(Batch 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)
Sets the color of subsequently added text.
|
void |
setColor(float color)
Sets the color of subsequently added text.
|
void |
setColor(float r,
float g,
float b,
float a)
Sets the color of subsequently added text.
|
void |
setColors(Color tint)
Sets the color of all text currently in the cache.
|
void |
setColors(Color tint,
int start,
int end)
Sets the color of the specified characters.
|
void |
setColors(float color)
Sets the color of all text currently in the cache.
|
void |
setColors(float r,
float g,
float b,
float a)
Sets the color of all text currently in the cache.
|
BitmapFont.TextBounds |
setMultiLineText(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(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(CharSequence str,
float x,
float y)
Clears any cached glyphs and adds glyphs for the specified text.
|
BitmapFont.TextBounds |
setText(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(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(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 |
tint(Color tint)
Tints all text currently in the cache.
|
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 coordinatepublic void translate(float xAmount, float yAmount)
xAmount
- The amount in x to move the textyAmount
- The amount in y to move the textpublic void tint(Color tint)
public void setColors(float color)
public void setColors(Color tint)
public void setColors(float r, float g, float b, float a)
public void setColors(Color tint, int start, int end)
setText(CharSequence, float, float)
and
is reset every time setText is called.public void setColor(Color tint)
public void setColor(float r, float g, float b, float a)
public void setColor(float color)
public Color getColor()
public void draw(Batch spriteBatch)
public void draw(Batch spriteBatch, int start, int end)
public void draw(Batch spriteBatch, float alphaModulation)
public void clear()
public BitmapFont.TextBounds setText(CharSequence str, float x, float y)
public BitmapFont.TextBounds setText(CharSequence str, float x, float y, int start, int end)
public BitmapFont.TextBounds addText(CharSequence str, float x, float y)
public BitmapFont.TextBounds addText(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(CharSequence str, float x, float y)
#addMultiLineText(CharSequence, float, float, float, HAlignment)
public BitmapFont.TextBounds setMultiLineText(CharSequence str, float x, float y, float alignmentWidth, BitmapFont.HAlignment alignment)
#addMultiLineText(CharSequence, float, float, float, HAlignment)
public BitmapFont.TextBounds addMultiLineText(CharSequence str, float x, float y)
#addMultiLineText(CharSequence, float, float, float, HAlignment)
public BitmapFont.TextBounds addMultiLineText(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(CharSequence str, float x, float y, float wrapWidth)
#addWrappedText(CharSequence, float, float, float, HAlignment)
public BitmapFont.TextBounds setWrappedText(CharSequence str, float x, float y, float wrapWidth, BitmapFont.HAlignment alignment)
#addWrappedText(CharSequence, float, float, float, HAlignment)
public BitmapFont.TextBounds addWrappedText(CharSequence str, float x, float y, float wrapWidth)
#addWrappedText(CharSequence, float, float, float, HAlignment)
public BitmapFont.TextBounds addWrappedText(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)
Copyright © 2014. All rights reserved.