|
libgdx API | |||||||||
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 | |
---|---|
void |
dispose()
Disposes the underlying BitmapFont of this cache. |
void |
draw(SpriteBatch spriteBatch)
|
void |
draw(SpriteBatch spriteBatch,
float alphaModulation)
|
BitmapFont.TextBounds |
getBounds()
Returns the size of the cached string. |
Color |
getColor()
|
BitmapFont |
getFont()
|
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(float color)
|
void |
setColor(float r,
float g,
float b,
float a)
|
BitmapFont.TextBounds |
setMultiLineText(java.lang.CharSequence str,
float x,
float y)
Caches a string, which may contain newlines (\n), with the specified position. |
BitmapFont.TextBounds |
setMultiLineText(java.lang.CharSequence str,
float x,
float y,
float alignmentWidth,
BitmapFont.HAlignment alignment)
Caches a string, which may contain newlines (\n), with the specified position and alignment. |
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)
Caches a string with the specified position. |
BitmapFont.TextBounds |
setText(java.lang.CharSequence str,
float x,
float y,
int start,
int end)
Caches a substring with the specified position. |
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)
Caches a string, which may contain newlines (\n), with the specified position. |
BitmapFont.TextBounds |
setWrappedText(java.lang.CharSequence str,
float x,
float y,
float wrapWidth,
BitmapFont.HAlignment alignment)
Caches a string, which may contain newlines (\n), with the specified position. |
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 |
---|
clone, equals, finalize, 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 draw(SpriteBatch spriteBatch)
public void draw(SpriteBatch spriteBatch, float alphaModulation)
public Color getColor()
public BitmapFont.TextBounds setText(java.lang.CharSequence str, float x, float y)
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
).
public BitmapFont.TextBounds setText(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)
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
).
public BitmapFont.TextBounds setMultiLineText(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
).
public BitmapFont.TextBounds setWrappedText(java.lang.CharSequence str, float x, float y, float wrapWidth)
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
).
public BitmapFont.TextBounds setWrappedText(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
).
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 dispose()
dispose
in interface Disposable
public void setUseIntegerPositions(boolean use)
use
- public boolean usesIntegerPositions()
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |