|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.newdawn.slick.SpriteSheetFont
public class SpriteSheetFont
A font implementation that will use the graphics inside a SpriteSheet for its data. This is useful when your font has a fixed width and height for each character as opposed to the more complex AngelCodeFont that allows different sizes and kerning for each character.
| Constructor Summary | |
|---|---|
SpriteSheetFont(SpriteSheet font,
char startingCharacter)
Create a new font based on a SpriteSheet. |
|
| Method Summary | |
|---|---|
void |
drawString(float x,
float y,
java.lang.String text)
Draw a string to the screen |
void |
drawString(float x,
float y,
java.lang.String text,
Color col)
Draw a string to the screen |
void |
drawString(float x,
float y,
java.lang.String text,
Color col,
int startIndex,
int endIndex)
Draw part of a string to the screen. |
int |
getHeight(java.lang.String text)
Get the height of the given string |
int |
getLineHeight()
Get the maximum height of any line drawn by this font |
int |
getWidth(java.lang.String text)
Get the width of the given string |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SpriteSheetFont(SpriteSheet font,
char startingCharacter)
!"#$%&'()*+,-./ 0123456789:;<=>? @ABCDEFGHIJKLMNO PQRSTUVWXYZ[\]^_In this set, ' ' (SPACE) would be the startingCharacter of your characterSet.
font - The SpriteSheet holding the font data.startingCharacter - The first character that is defined in the SpriteSheet.| Method Detail |
|---|
public void drawString(float x,
float y,
java.lang.String text)
Font
drawString in interface Fontx - The x location at which to draw the stringy - The y location at which to draw the stringtext - The text to be displayedFont.drawString(float, float, java.lang.String)
public void drawString(float x,
float y,
java.lang.String text,
Color col)
Font
drawString in interface Fontx - 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 withFont.drawString(float, float, java.lang.String, org.newdawn.slick.Color)
public void drawString(float x,
float y,
java.lang.String text,
Color col,
int startIndex,
int endIndex)
Font
drawString in interface Fontx - 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 drawFont.drawString(float, float, String, Color, int, int)public int getHeight(java.lang.String text)
Font
getHeight in interface Fonttext - The string to obtain the rendered with of
Font.getHeight(java.lang.String)public int getWidth(java.lang.String text)
Font
getWidth in interface Fonttext - The string to obtain the rendered with of
Font.getWidth(java.lang.String)public int getLineHeight()
Font
getLineHeight in interface FontFont.getLineHeight()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||