public class BitmapFontCache extends Object
Constructor and Description |
---|
BitmapFontCache(BitmapFont font) |
BitmapFontCache(BitmapFont font,
boolean integer) |
Modifier and Type | Method and Description |
---|---|
GlyphLayout |
addText(CharSequence str,
float x,
float y)
Adds glyphs for the specified text.
|
GlyphLayout |
addText(CharSequence str,
float x,
float y,
float targetWidth,
int halign,
boolean wrap)
Adds glyphs for the specified text.
|
GlyphLayout |
addText(CharSequence str,
float x,
float y,
int start,
int end,
float targetWidth,
int halign,
boolean wrap)
Adds glyphs for the specified text.
|
GlyphLayout |
addText(CharSequence str,
float x,
float y,
int start,
int end,
float targetWidth,
int halign,
boolean wrap,
String truncate)
Adds glyphs for the the specified text.
|
void |
addText(GlyphLayout layout,
float x,
float y)
Adds the specified glyphs.
|
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) |
Color |
getColor()
Returns the color used for subsequently added text.
|
BitmapFont |
getFont() |
Array<GlyphLayout> |
getLayouts() |
int |
getVertexCount(int page) |
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 |
setAlphas(float alpha)
Sets the alpha component of all text currently in the cache.
|
void |
setColor(Color color)
A convenience method for setting the cache color.
|
void |
setColor(float r,
float g,
float b,
float a)
A convenience method for setting the cache color.
|
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.
|
void |
setColors(float color,
int start,
int end)
Sets the color of the specified characters.
|
void |
setPosition(float x,
float y)
Sets the position of the text, relative to the position when the cached text was created.
|
GlyphLayout |
setText(CharSequence str,
float x,
float y)
Clears any cached glyphs and adds glyphs for the specified text.
|
GlyphLayout |
setText(CharSequence str,
float x,
float y,
float targetWidth,
int halign,
boolean wrap)
Clears any cached glyphs and adds glyphs for the specified text.
|
GlyphLayout |
setText(CharSequence str,
float x,
float y,
int start,
int end,
float targetWidth,
int halign,
boolean wrap)
Clears any cached glyphs and adds glyphs for the specified text.
|
GlyphLayout |
setText(CharSequence str,
float x,
float y,
int start,
int end,
float targetWidth,
int halign,
boolean wrap,
String truncate)
Clears any cached glyphs and adds glyphs for the specified text.
|
void |
setText(GlyphLayout layout,
float x,
float y)
Clears any cached glyphs and adds the specified glyphs.
|
void |
setUseIntegerPositions(boolean use)
Specifies whether to use integer positions or not.
|
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)
integer
- If true, rendering positions will be at integer values to avoid filtering artifacts.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 setAlphas(float alpha)
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 setColors(float color, int start, int end)
setText(CharSequence, float, float)
and
is reset every time setText is called.public Color getColor()
public void setColor(Color color)
getColor()
.public void setColor(float r, float g, float b, float a)
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 GlyphLayout setText(CharSequence str, float x, float y)
public GlyphLayout setText(CharSequence str, float x, float y, float targetWidth, int halign, boolean wrap)
public GlyphLayout setText(CharSequence str, float x, float y, int start, int end, float targetWidth, int halign, boolean wrap)
public GlyphLayout setText(CharSequence str, float x, float y, int start, int end, float targetWidth, int halign, boolean wrap, String truncate)
public void setText(GlyphLayout layout, float x, float y)
public GlyphLayout addText(CharSequence str, float x, float y)
public GlyphLayout addText(CharSequence str, float x, float y, float targetWidth, int halign, boolean wrap)
public GlyphLayout addText(CharSequence str, float x, float y, int start, int end, float targetWidth, int halign, boolean wrap)
public GlyphLayout addText(CharSequence str, float x, float y, int start, int end, float targetWidth, int halign, boolean wrap, String truncate)
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).targetWidth
- The width of the area the text will be drawn, for wrapping or truncation.halign
- Horizontal alignment of the text, see Align
.wrap
- If true, the text will be wrapped within targetWidth.truncate
- If not null, the text will be truncated within targetWidth with this string appended. May be an empty
string.public void addText(GlyphLayout layout, float x, float y)
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)
public int getVertexCount(int page)
public Array<GlyphLayout> getLayouts()
Copyright © 2016. All rights reserved.