|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vizzini.ui.graphics.shape.AbstractShape
org.vizzini.ui.game.boardgame.BoardShape
public class BoardShape
Provides a board for 3D games.
Field Summary | |
---|---|
protected ITokenUI[][] |
_grid
Collection of token UIs. |
protected int[] |
_polyX
Array used by paintSquares() method. |
protected int[] |
_polyY
Array used by paintSquares() method. |
static double |
HEIGHT
The height in centimeters from Star Fleet Technical Manual. |
static double |
SQUARE_SIZE
Square size in centimeters from Star Fleet Technical Manual. |
Fields inherited from class org.vizzini.ui.graphics.shape.AbstractShape |
---|
_isWireframe, _points, _screenCenter, _screenPoints, _shapeGroup, _zNormal |
Constructor Summary | |
---|---|
BoardShape(int fileCount,
int rankCount,
int levelOffset)
Construct this object with the given parameters. |
|
BoardShape(int fileCount,
int rankCount,
int fileOffset,
int rankOffset,
int levelOffset)
Construct this object with the given parameters. |
Method Summary | |
---|---|
void |
add(HighlightData highlightData)
Add the given highlight data. |
void |
add(ITokenUI shape)
Add the given shape as a child of this. |
void |
clearHighlights()
Clear the highlighted positions. |
protected void |
computeCenters()
Compute the centers of the squares so we'll know where to place pieces. |
void |
computeScreenPoints(Quaternion q,
Vector v,
double magnify,
int offsetX,
int offsetY,
double d)
Compute the points of this shape in screen coordinates. |
protected void |
drawOn(Graphics g,
double magnify,
boolean wireframe)
Draw this shape on the given graphics using the given parameters. |
protected Vector[][] |
getCenters()
Return the offset. |
HighlightData |
getCurrentHighlightData()
|
int |
getFileOffset()
Return the file offset. |
Color |
getLabelColor()
Return the label color. |
int |
getLevelOffset()
Return the level offset. |
protected int[] |
getOffset()
Return the offset. |
IntegerPosition |
getPositionForPoint(Point point)
Map the screen coordinates to a board position. |
int |
getRankOffset()
Return the rank offset. |
ITokenUI |
getTokenAt(int file,
int rank)
Return the token UI at the given position. |
boolean |
isLabelPainted()
Return true if the label painted flag is true. |
protected void |
paintHighlight(Graphics2D g,
HighlightData data)
Paint the given square highlight. |
protected void |
paintHighlights(Graphics2D g)
Paint the square highlights. |
protected void |
paintLabels(Graphics2D g)
Paint the labels. |
protected void |
paintSquares(Graphics2D g)
Paint the squares. |
void |
remove(HighlightData highlightData)
Add the given highlight data. |
void |
remove(IShape shape)
Remove the given shape as a child of this. |
void |
setCurrentHighlightData(HighlightData highlightData)
Set the current highlight data. |
void |
setFirstColor(Color color)
Set the first color, the color of the square at (0,0). |
void |
setLabelColor(Color color)
Set the label color. |
void |
setLabelPainted(boolean isLabelPainted)
Set the label painted flag. |
void |
setOffsets(int fileOffset,
int rankOffset,
int levelOffset)
Set the offsets. |
void |
setSecondColor(Color color)
Set the second color, the color not at (0,0). |
Methods inherited from class org.vizzini.ui.graphics.shape.AbstractShape |
---|
add, clear, compareTo, computeCenteredScreenPoints, computeNormalZComponent, computeScreenCenter, contains, createState, createStatefulSupport, drawOn, drawOnSolid, drawOnWireframe, getAbsoluteState, getBounds, getChildren, getColor, getColorForIntensity, getDepth, getDimensions, getHeight, getMinDimension, getName, getScreenCenter, getShapeGroup, getState, getStatefulParent, getTextureFilepath, getWidth, isInFrontOf, isLightSource, isTextureFilepathSet, isVisible, isWireframe, setColor, setLightSource, setName, setStatefulParent, setTextureFilepath, setVisible, setWireframe, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final double HEIGHT
public static final double SQUARE_SIZE
protected ITokenUI[][] _grid
protected int[] _polyX
protected int[] _polyY
Constructor Detail |
---|
public BoardShape(int fileCount, int rankCount, int levelOffset)
fileCount
- The number of files.rankCount
- The number of ranks.levelOffset
- The offset of this board from level=0.public BoardShape(int fileCount, int rankCount, int fileOffset, int rankOffset, int levelOffset)
fileCount
- The number of files.rankCount
- The number of ranks.fileOffset
- The offset of this board from file=0.rankOffset
- The offset of this board from rank=0.levelOffset
- The offset of this board from level=0.Method Detail |
---|
public void add(ITokenUI shape)
shape
- The new child shape.public void add(HighlightData highlightData)
public void clearHighlights()
public void computeScreenPoints(Quaternion q, Vector v, double magnify, int offsetX, int offsetY, double d)
computeScreenPoints
in interface IShape
computeScreenPoints
in class AbstractShape
q
- Rotation of the parent to world coordinates.v
- The parent position in world coordinates..magnify
- The magnification.offsetX
- The offset X coordinate.offsetY
- The offset Y coordinate.d
- Perspective constant.public HighlightData getCurrentHighlightData()
public int getFileOffset()
public Color getLabelColor()
public int getLevelOffset()
public IntegerPosition getPositionForPoint(Point point)
point
- A mouse click point.public int getRankOffset()
public ITokenUI getTokenAt(int file, int rank)
public boolean isLabelPainted()
public void remove(HighlightData highlightData)
public void remove(IShape shape)
remove
in interface IShape
remove
in class AbstractShape
shape
- The new child shape.public void setCurrentHighlightData(HighlightData highlightData)
public void setFirstColor(Color color)
public void setLabelColor(Color color)
public void setLabelPainted(boolean isLabelPainted)
public void setOffsets(int fileOffset, int rankOffset, int levelOffset)
public void setSecondColor(Color color)
protected void computeCenters()
protected void drawOn(Graphics g, double magnify, boolean wireframe)
drawOn
in class AbstractShape
g
- The graphics on which to draw.magnify
- The magnification.wireframe
- If true, draw this as a wireframe shape. This
parameter is not used by this class.protected Vector[][] getCenters()
protected int[] getOffset()
protected void paintHighlight(Graphics2D g, HighlightData data)
g
- The graphics on which to draw.protected void paintHighlights(Graphics2D g)
g
- The graphics on which to draw.protected void paintLabels(Graphics2D g)
g
- The graphics on which to draw.protected void paintSquares(Graphics2D g)
g
- The graphics on which to draw.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |