|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjme.geometry.hud.text.Font2D
Font2D
maintains display lists for each ASCII character
defined by an image. Font2D
assumes that the texture is 256x256
and that the characters are 16 pixels high by 16 pixels wide. The order of
the characters is also important:
After the font is loaded, it can be used with a call to print
.
The Font2D
class is also printed in Ortho mode and billboarded,
as well as depth buffering turned off. This means that the font will be
placed at a two dimensional coordinate that corresponds to screen coordinates.
Field Summary | |
static int |
ITALICS
|
static int |
NORMAL
|
Constructor Summary | |
Font2D(java.lang.String texture)
Constructor takes a path to the texture to use of the font base. |
Method Summary | |
void |
buildDisplayList()
buildDisplayList sets up the 256 display lists that are
used to render each font character. |
void |
deleteFont()
deleteFont deletes the current display list of font objects. |
void |
print(int x,
int y,
java.lang.String text,
int set)
print renders the specified string to a given (x,y) location. |
void |
setColor(float r,
float g,
float b,
float a)
setColor sets the RGBA values to render the font as. |
void |
setFontTexture(java.lang.String texture)
setFontTexture sets the texture the Font2D
object to that which is passed in. |
java.lang.String |
toString()
toString returns the string representation of this
font object in the Format:jme.geometry.hud.text.Font2D@1c282a1 Color: {RGBA COLOR} Blended: {BOOLEAN VALUE} Texture: {IMAGE FILE} |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int NORMAL
public static final int ITALICS
Constructor Detail |
public Font2D(java.lang.String texture)
TextureManager
's
image types.
texture
- the path to the image that defines the fonts.TextureManager
Method Detail |
public void setFontTexture(java.lang.String texture)
setFontTexture
sets the texture the Font2D
object to that which is passed in.
texture
- the new texture to use.public void setColor(float r, float g, float b, float a)
setColor
sets the RGBA values to render the font as.
By default the color is white with no transparency.
r
- the red component of the color.g
- the green component of the color.b
- the blue component of the color.a
- the alpha component of the color.public void deleteFont()
deleteFont
deletes the current display list of font objects.
The font will be useless until a call to buildDisplayLists
is made.
public void print(int x, int y, java.lang.String text, int set)
print
renders the specified string to a given (x,y) location.
The x, y location is in terms of screen coordinates. There are currently
two sets of fonts supported: NORMAL and ITALICS.
x
- the x screen location to start the string render.y
- the y screen location to start the string render.text
- the String to render.set
- the mode of font: NORMAL or ITALICS.public void buildDisplayList()
buildDisplayList
sets up the 256 display lists that are
used to render each font character. Each list quad is 16x16, as defined
by the font image size.
public java.lang.String toString()
toString
returns the string representation of this
font object in the Format:
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |