|
Genuts ME API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genuts.gameui.Sprite
com.genuts.gameui.SpriteLabel
com.genuts.gameui.SpriteCounter
com.genuts.gameui.SpriteImageCounter
This object is for representation of all counter type such player's score with an image.
To represent digits, the counter use a big image with 10 digits. For example, you can use this image:
You have to specify the number of digit to display, by default,
it is 3, and it will resize the component automaticly.
You have the ability to display all digits of the counter,
or not to display 0 value on the left side. By default, the counter desn't
display all digits.
SpriteCounter
Constructor Summary | |
SpriteImageCounter(Image digits,
int nbh,
int nbv)
Initializes the counter with an image of digits. |
|
SpriteImageCounter(Image digits,
int nbh,
int nbv,
int digitsCount)
Initializes the counter with an image of digits and a specified number of digits to display. |
Method Summary | |
Image |
getDigitsImage()
Gets the digits from the image for this counter. |
int |
getHorizontalPictures()
Gets the number of pictures contained horizontally in the image of digits. |
int |
getVerticalPictures()
Gets the number of pictures contained vertically in the image of digits. |
protected void |
initSprite()
Initializes the counter sprite. |
void |
paint(Graphics g)
Paint this counter. |
void |
setDigitsImage(Image digits,
int nbh,
int nbv)
Sets the image of digits for this counter. |
Methods inherited from class com.genuts.gameui.SpriteCounter |
addValue, getDigitsCount, getMaximumValue, getValue, isDisplayAllDigits, setDigitsCount, setDisplayAllDigits, setMaximumValue, setValue, subValue |
Methods inherited from class com.genuts.gameui.SpriteLabel |
getBaseline, getColor, getFont, getText, setBaseline, setColor, setFont, setParent, setText |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SpriteImageCounter(Image digits, int nbh, int nbv)
digits
- An image containing 10 pictures of digits.nbh
- Horizontaly number of pictures in the image.nbv
- Verticaly number of pictures in the image.public SpriteImageCounter(Image digits, int nbh, int nbv, int digitsCount)
digits
- An image containing 10 pictures of digits.nbh
- Horizontaly number of pictures in the image.nbv
- Verticaly number of pictures in the image.digitsCount
- Number of digits to display.Method Detail |
public Image getDigitsImage()
public int getHorizontalPictures()
public int getVerticalPictures()
public void setDigitsImage(Image digits, int nbh, int nbv)
nbh
*nbv
)
mustbe equal to 10.
digits
- An image containing 10 pictures of digits.nbh
- Horizontaly number of pictures in the image.nbv
- Verticaly number of pictures in the image.
java.lang.IllegalAccessError
- if nbh or nbv is equal to 0 or
if the number of picture is not equal to 10.protected void initSprite()
SpriteCounter
initSprite
in class SpriteCounter
public void paint(Graphics g)
paint
in class SpriteLabel
g
- The graphics context to use for painting.
|
Genuts ME API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |