|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jrummikub.view.impl.StonePainter
class StonePainter
The StonePainter paints stones and converts between pixel and grid coordinates
Field Summary | |
---|---|
static float |
HEIGHT_SCALE
The height of one pixel in the scale of 1.0 |
static float |
WIDTH_SCALE
The width of one pixel in the scale of 1.0 |
Constructor Summary | |
---|---|
StonePainter(float scale)
|
Method Summary | |
---|---|
Position |
calculatePosition(int x,
int y)
|
int |
getStoneHeight()
|
int |
getStoneWidth()
|
void |
paintStone(java.awt.Graphics2D g,
Stone stone,
Position p,
boolean selected,
boolean hovered)
Paints a stone |
void |
setScale(float scale)
Sets the new grid scale |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final float WIDTH_SCALE
public static final float HEIGHT_SCALE
Constructor Detail |
---|
StonePainter(float scale)
scale
- the scaling factor for the grid coordinatesMethod Detail |
---|
public void setScale(float scale)
scale
- the new scalepublic Position calculatePosition(int x, int y)
x
- x position in screen coordinatesy
- y position in screen coordinates
public int getStoneWidth()
public int getStoneHeight()
public void paintStone(java.awt.Graphics2D g, Stone stone, Position p, boolean selected, boolean hovered)
g
- the graphics context to paint the stone onstone
- the stone to paintp
- the position of the stoneselected
- if selected is true the stone will be painted darkerhovered
- if hovered is true the stone will be painted brighter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |