public class LibgdxBitmapFontCache extends java.lang.Object implements GameFontCache
Constructor and Description |
---|
LibgdxBitmapFontCache(LibgdxBitmapFont font) |
LibgdxBitmapFontCache(LibgdxBitmapFont font,
boolean integer) |
Modifier and Type | Method and Description |
---|---|
void |
addText(java.lang.CharSequence str,
float x,
float y)
Adds text to the cache
|
void |
addText(java.lang.CharSequence str,
float x,
float y,
float targetWidth,
int halign,
boolean wrap)
Adds text to the cache
|
void |
clear()
Clears all text from the cache
|
void |
draw(Graphics g)
Draws the cache to the
Graphics context |
Color |
getColor()
Returns the
Color used for subsequent text operations |
GameFont |
getFont()
Returns the underlying
GameFont for this cache |
void |
setAllAlphas(float alpha)
Sets the
Color alpha for previous text operations |
void |
setAllColors(Color color)
Sets the
Color for previous text operations |
void |
setColor(Color color)
Sets the
Color for subsequent text operations |
void |
setPosition(float x,
float y)
Sets the position of the cache
|
void |
setText(java.lang.CharSequence str,
float x,
float y)
Clears all text from the cache and adds a new text sequence
|
void |
setText(java.lang.CharSequence str,
float x,
float y,
float targetWidth,
int halign,
boolean wrap)
Clears all text from the cache and adds a new text sequence
|
void |
translate(float x,
float y)
Sets the position of the text relative to its current position
|
public LibgdxBitmapFontCache(LibgdxBitmapFont font)
public LibgdxBitmapFontCache(LibgdxBitmapFont font, boolean integer)
public void addText(java.lang.CharSequence str, float x, float y)
GameFontCache
addText
in interface GameFontCache
str
- The text to be addedx
- The x coordinate to add the text toy
- The y coordinate to add the text topublic void addText(java.lang.CharSequence str, float x, float y, float targetWidth, int halign, boolean wrap)
GameFontCache
addText
in interface GameFontCache
str
- The text to be addedx
- The x coordinate to add the text toy
- The y coordinate to add the text totargetWidth
- The target width of the text (text will wrap if exceeded)halign
- The horizontal alignment based on Align
public void clear()
GameFontCache
clear
in interface GameFontCache
public void draw(Graphics g)
GameFontCache
Graphics
contextdraw
in interface GameFontCache
g
- The Graphics
context to draw topublic Color getColor()
GameFontCache
Color
used for subsequent text operationsgetColor
in interface GameFontCache
Color
to draw withpublic void setColor(Color color)
GameFontCache
Color
for subsequent text operationssetColor
in interface GameFontCache
color
- The Color
to draw withpublic void setAllColors(Color color)
GameFontCache
Color
for previous text operationssetAllColors
in interface GameFontCache
color
- The Color
to draw withpublic void setAllAlphas(float alpha)
GameFontCache
Color
alpha for previous text operationssetAllAlphas
in interface GameFontCache
alpha
- The alpha to draw withpublic void setText(java.lang.CharSequence str, float x, float y)
GameFontCache
setText
in interface GameFontCache
str
- The text to be addedx
- The x coordinate to add the text toy
- The y coordinate to add the text topublic void setText(java.lang.CharSequence str, float x, float y, float targetWidth, int halign, boolean wrap)
GameFontCache
setText
in interface GameFontCache
str
- The text to be addedx
- The x coordinate to add the text toy
- The y coordinate to add the text totargetWidth
- The target width of the text (text will wrap if exceeded)halign
- The horizontal alignment of the text based on Align
wrap
- True if the text should wrap when exceeding the targetWidth, false if the text should clippublic void translate(float x, float y)
GameFontCache
translate
in interface GameFontCache
x
- The amount to move by on the x axisy
- The amount to move by on the y axispublic void setPosition(float x, float y)
GameFontCache
setPosition
in interface GameFontCache
x
- The amount to move by on the x axisy
- The amount to move by on the y axispublic GameFont getFont()
GameFontCache
GameFont
for this cachegetFont
in interface GameFontCache
GameFont
this cache was created for