|
GF4J 0.9.4 Beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gameframe.util.Counter
A counter that can display almost any number of digits. The counter uses
a rolling counter by default. In order to update the shown value you must
tick()
this counter. This causes the counter to adjust its
value towards the final value in steps (makes a nice rolling effect).
Methods addImmediately and decImmediately adjust the counter immediately.
The maximum number of digits this counter can show is the maximum number
of digits that can fit to an integer.
Constructor Summary | |
Counter(int initialCount,
int x,
int y,
int numDigits)
Constructs a counter that uses the currently set font bitmap for numbers, has the given initial value, is located at the given screen coordinates and uses the given number of digits. |
Method Summary | |
void |
add(int count)
Adds the given number to the counter. |
void |
addImmediately(int count)
Adds the given number to the counter immediately. |
void |
dec(int count)
Decrements the given number from the counter. |
void |
decImmediately(int count)
Decrements the given number from the counter immediately. |
int |
getCount()
Returns the current (real) counter value. |
int |
getHeight()
Returns the height of this counter. |
int |
getWidth()
Returns the width of this counter. |
int |
getX()
Returns the base x-coordinate of the counter based upon the number of digits it needs to display. |
int |
getY()
Returns the base y-coordinate. |
void |
paint()
Paints this counter to the backbuffer. |
void |
reset()
Resets this counter to its inital value. |
void |
setCount(int count)
Sets the count of this counter to the given number. |
void |
setImmediately(int count)
Sets the given counter value immediately without the fancy scrolling effect. |
void |
setX(int x)
Sets the upper left coordinate. |
void |
setY(int y)
Sets the upper left coordinate. |
void |
tick()
Calcultes the value of this counter every time called. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Counter(int initialCount, int x, int y, int numDigits) throws GameFrameException
aNumbers
- The bitmaps that represent numbers.initialCount
- The initial counter value.x
- The base x-coordinate of the counter.y
- The base y-coordinate of the counter.numDigits
- The number of digits (between 1 to 6) that are displayed.Method Detail |
public void tick()
public void reset()
public void paint()
public int getCount()
public void add(int count)
count
- The number to add to this counter.public void addImmediately(int count)
count
- The number to add to this counter.public void dec(int count)
count
- The number to decrement from this counter.public void decImmediately(int count)
count
- The number to decrement from this counter.public void setCount(int count)
count
- The counters new value.public void setImmediately(int count)
public int getX()
public void setX(int x)
x
- The x-coordinate this counter will use.public int getY()
public void setY(int y)
y
- The y-coordinate this counter will use.public int getWidth()
public int getHeight()
|
GF4J 0.9.4 Beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |