public class BitmapFontImpl extends Object implements BitmapFont
Constructor and Description |
---|
BitmapFontImpl(BitmapFontRenderer fontRenderer,
ResourceLoader resourceLoader,
BitmapFontData fontData,
String filename)
Create a BitmapFont using the given BitmapFontRenderer and the BitmapFontData.
|
Modifier and Type | Method and Description |
---|---|
int |
getCharacterWidth(char currentCharacter,
char nextCharacter)
Get the width of a single character.
|
int |
getCharacterWidth(char currentCharacter,
char nextCharacter,
float size)
The same as the getCharacterWidth(int, char) method but takes a scaled size into account.
|
int |
getHeight()
The height of the given font (the lineHeight property of the font data)
|
int |
getStringWidth(String text)
Returns the width of the given String.
|
int |
getStringWidth(String text,
float size)
The same as the getStringWidthInternal(String) method that takes the given size into account.
|
void |
renderText(int x,
int y,
String text)
Output text at the given x and y positon.
|
void |
renderText(int x,
int y,
String text,
float sizeX,
float sizeY,
float r,
float g,
float b,
float a)
Output text at the given x and y position using the given color and the r,g,b,a components.
|
public BitmapFontImpl(BitmapFontRenderer fontRenderer, ResourceLoader resourceLoader, BitmapFontData fontData, String filename)
fontRenderer
- font rendererfontData
- font datafilename
- the original filename of the fnt (the path part is used to resolve any bitmap references inside
the .fnt file!)public void renderText(int x, int y, String text)
BitmapFont
renderText
in interface BitmapFont
x
- x positiony
- y positiontext
- text to outputpublic void renderText(int x, int y, String text, float sizeX, float sizeY, float r, float g, float b, float a)
BitmapFont
renderText
in interface BitmapFont
x
- x positiony
- y positiontext
- the text to outputsizeX
- x scale factor of the text (this should be apply with x,y as the origin)sizeY
- y scale factor of the text (this should be apply with x,y as the origin)r
- redg
- greenb
- bluea
- alphapublic int getCharacterWidth(char currentCharacter, char nextCharacter)
BitmapFont
getCharacterWidth
in interface BitmapFont
currentCharacter
- current characternextCharacter
- next characterpublic int getCharacterWidth(char currentCharacter, char nextCharacter, float size)
BitmapFont
getCharacterWidth
in interface BitmapFont
public int getStringWidth(String text)
BitmapFont
getStringWidth
in interface BitmapFont
text
- the textpublic int getStringWidth(String text, float size)
BitmapFont
getStringWidth
in interface BitmapFont
public int getHeight()
BitmapFont
getHeight
in interface BitmapFont
Copyright © 2013. All Rights Reserved.