Class AngelCodeFont
java.lang.Object
zombie.core.fonts.AngelCodeFont
- All Implemented Interfaces:
AssetStateObserver
,Font
A font implementation that will parse BMFont format font files. The font files can be output
by Hiero, which is included with Slick, and also the AngelCode font tool available at:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
The definition of a single character as defined in the AngelCode file formatstatic final class
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAngelCodeFont
(String _fntFile, String imgFile) Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.AngelCodeFont
(String _fntFile, Texture image) Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool. -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
void
drawString
(float x, float y, float scale, String text, float r, float g, float b, float a) void
drawString
(float x, float y, float scale, String text, float r, float g, float b, float a, int startIndex, int endIndex) void
drawString
(float x, float y, String text) Description copied from interface: Fontvoid
drawString
(float x, float y, String text, float r, float g, float b, float a) void
drawString
(float x, float y, String text, float r, float g, float b, float a, int startIndex, int endIndex) void
drawString
(float x, float y, String text, Color col) Description copied from interface: Fontvoid
drawString
(float x, float y, String text, Color col, int startIndex, int endIndex) Description copied from interface: Fontint
Description copied from interface: Fontint
int
Description copied from interface: Fontint
Description copied from interface: Fontint
int
int
int
getYOffset
(String text) Returns the distance from the y drawing location to the top most pixel of the specified text.boolean
isEmpty()
void
onStateChanged
(Asset.State oldState, Asset.State newState, Asset asset)
-
Field Details
-
chars
The characters building up the font -
xoff
public static int xoff -
yoff
public static int yoff -
curCol
-
curR
public static float curR -
curG
public static float curG -
curB
public static float curB -
curA
public static float curA
-
-
Constructor Details
-
AngelCodeFont
Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.- Parameters:
_fntFile
- The location of the font defnition fileimage
- The image to use for the font- Throws:
FileNotFoundException
-
AngelCodeFont
Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.- Parameters:
_fntFile
- The location of the font defnition fileimgFile
- The location of the font image- Throws:
FileNotFoundException
-
-
Method Details
-
drawString
Description copied from interface: Font- Specified by:
drawString
in interfaceFont
- Parameters:
x
- The x location at which to draw the stringy
- The y location at which to draw the stringtext
- The text to be displayed
-
drawString
Description copied from interface: Font- Specified by:
drawString
in interfaceFont
- Parameters:
x
- The x location at which to draw the stringy
- The y location at which to draw the stringtext
- The text to be displayedcol
- The colour to draw with
-
drawString
-
drawString
public void drawString(float x, float y, float scale, String text, float r, float g, float b, float a) -
drawString
Description copied from interface: Font- Specified by:
drawString
in interfaceFont
- Parameters:
x
- The x location at which to draw the stringy
- The y location at which to draw the stringtext
- The text to be displayedcol
- The colour to draw withstartIndex
- The index of the first character to drawendIndex
- The index of the last character from the string to draw
-
drawString
public void drawString(float x, float y, String text, float r, float g, float b, float a, int startIndex, int endIndex) -
drawString
public void drawString(float x, float y, float scale, String text, float r, float g, float b, float a, int startIndex, int endIndex) -
getHeight
-
getHeight
-
getLineHeight
public int getLineHeight()Description copied from interface: Font- Specified by:
getLineHeight
in interfaceFont
- Returns:
- The maxium height of any line drawn by this font
-
getWidth
-
getWidth
-
getWidth
-
getWidth
-
getYOffset
Returns the distance from the y drawing location to the top most pixel of the specified text.- Parameters:
text
- The text that is to be tested- Returns:
- The yoffset from the y draw location at which text will start
-
onStateChanged
- Specified by:
onStateChanged
in interfaceAssetStateObserver
-
isEmpty
public boolean isEmpty() -
destroy
public void destroy()
-