|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ctf.environment.Grid
Generic grid for a capture the flag board. Each location on board can either contain an item or not, but the item type isn't specified. Designed to be extended by more specific grids. Note that this class only has package access enabled.
Field Summary | |
protected Color |
mFillColor
|
protected Color |
mLineColor
|
Constructor Summary | |
protected |
Grid(int inBoardSize)
Constructs a Grid . |
protected |
Grid(int inBoardSize,
Color inLineColor,
Color inFillColor)
Constructs a Grid . |
Method Summary | |
(package private) void |
add(EnvironmentLocation inLocation)
Adds an object to the grid. |
(package private) void |
add(int inX,
int inY)
Adds an object to the grid. |
(package private) void |
clear()
Clears all objects from the grid. |
(package private) void |
draw(Graphics inGraphics,
int inStartX,
int inStartY,
int inWide,
int inHigh)
Draws the grid and all objects in it. |
protected abstract void |
drawObject(Graphics inGraphics,
int inStartX,
int inStartY,
int inWide,
int inHigh)
Draws a graphical representation of an object in a specific location in a graphics context. |
(package private) boolean |
exists(EnvironmentLocation inLocation)
Checks whether an object exists in a particular grid location. |
(package private) boolean |
exists(int inX,
int inY)
Checks whether an object exists in a particular grid location. |
Dimension |
getDrawDimension(int inSuggestedWide,
int inSuggestedHigh)
Gets the actual dimensions of the drawn grid when particular dimensions are requested. |
(package private) void |
remove(EnvironmentLocation inLocation)
Removes an object from the grid. |
(package private) void |
remove(int inX,
int inY)
Removes an object to the grid. |
void |
setFillColor(Color inFillColor)
Set fill color for drawing grid objects. |
void |
setLineColor(Color inLineColor)
Set line color for drawing grid objects. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected Color mLineColor
protected Color mFillColor
Constructor Detail |
protected Grid(int inBoardSize)
Grid
.inBoardSize
- the board width and height, in number of grid spaces.protected Grid(int inBoardSize, Color inLineColor, Color inFillColor)
Grid
.inBoardSize
- the board width and height, in number of grid spaces.inLineColor
- line color for drawing objects in this grid.inFillColor
- fill color for drawing objects in this grid.Method Detail |
void add(int inX, int inY)
inX
- the x component of the object's location.inY
- the y component of the object's location.void add(EnvironmentLocation inLocation)
inLocation
- location to add object in.void remove(int inX, int inY)
inX
- the x component of the object's location.inY
- the y component of the object's location.void remove(EnvironmentLocation inLocation)
inLocation
- location to remove object from.void clear()
boolean exists(int inX, int inY)
inX
- the x component of the location to check.inY
- the y component of the location to check.inX
and
inY
.boolean exists(EnvironmentLocation inLocation)
inLocation
- location to check.inLocation
.public void setFillColor(Color inFillColor)
inFillColor
- fill color for drawing objects in this grid.public void setLineColor(Color inLineColor)
inLineColor
- line color for drawing objects in this grid.void draw(Graphics inGraphics, int inStartX, int inStartY, int inWide, int inHigh)
inGraphics
- the graphics context in which to draw the grid.inStartX
- the starting x coordinate in inGraphics
for the grid.inStartY
- the starting y coordinate in inGraphics
for the grid.inWide
- the width of the grid image.inHigh
- the height of the grid image.public Dimension getDrawDimension(int inSuggestedWide, int inSuggestedHigh)
inSuggestedWide
- width to be requested for draw.inSuggestedHigh
- height to be requested for draw.protected abstract void drawObject(Graphics inGraphics, int inStartX, int inStartY, int inWide, int inHigh)
inGraphics
- the graphics context in which to draw the object.inStartX
- the starting x coordinate in inGraphics
for the object.inStartY
- the starting y coordinate in inGraphics
for the object.inWide
- the width of the object image.inHigh
- the height of the object image.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |