|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.graphics.g2d.BitmapFontCache
public class BitmapFontCache
Caches glyph geometry for a BitmapFont, providing a fast way to render static text. This saves needing to compute the location of each glyph each frame.
Constructor Summary | |
---|---|
BitmapFontCache(BitmapFont font)
|
|
BitmapFontCache(BitmapFont font,
boolean integer)
Creates a new BitmapFontCache |
Method Summary | |
---|---|
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(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(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 |
translate(float xAmount,
float yAmount)
Sets the position of the text, relative to its current position. |
boolean |
usesIntegerPositions()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BitmapFontCache(BitmapFont font)
public BitmapFontCache(BitmapFont font, boolean integer)
font
- the font to useinteger
- whether to use integer positions and sizes.Method Detail |
---|
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(CharSequence str, float x, float y)
addText(CharSequence, float, float, int, int)
public BitmapFont.TextBounds setText(CharSequence str, float x, float y, int start, int end)
addText(CharSequence, float, float, int, int)
public BitmapFont.TextBounds addText(CharSequence str, float x, float y)
addText(CharSequence, float, float, int, int)
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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |