|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJTP.TilePainter
public class TilePainter
Handles tile rendering
Constructor Summary | |
---|---|
TilePainter(Images imgData,
ScreenFrames frames,
Screen screen,
Font numberFont,
Font charFont,
Color numColor,
Color charColor,
Color gridColor,
Color gridHighlight,
Graphics2D g)
Constructs a new TilePainter instance with the given
attributes. |
Method Summary | |
---|---|
void |
drawGTiles(GameTile[][] tiles,
Point activePos,
Point activePos2,
boolean numbered,
Graphics2D g)
Renders the given tiles (in-game). |
void |
drawMenuString(String s,
boolean raised,
Rectangle location,
Graphics2D g)
Draws a string with each letter on a separate tile. |
void |
drawScoreString(String s,
boolean appendCursor,
boolean first,
int x,
int y,
Graphics2D g)
Variation of drawMenuString . |
void |
drawTiles(Tile[][] tiles,
Point activePos,
Point activePos2,
Point oldPos,
Point player2Start,
boolean dualStart,
Graphics2D g)
Renders the given tiles (editor). |
protected void |
drawTiles(Tile[][] tiles,
Rectangle gridArea,
int tileSize,
Point activePos,
Point activePos2,
Point oldPos,
Point player2Start,
boolean drawP2Start,
boolean dualStart,
boolean numbered,
Graphics2D g)
Renders the given tiles (editor/level-chooser). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TilePainter(Images imgData, ScreenFrames frames, Screen screen, Font numberFont, Font charFont, Color numColor, Color charColor, Color gridColor, Color gridHighlight, Graphics2D g) throws NullPointerException
TilePainter
instance with the given
attributes.
imgData
- graphics resourcesframes
- geometry informationnumberFont
- font to use for tile numberingcharFont
- font to use for all other charactersnumColor
- color of numbers on tilescharColor
- color of all other characters on tilesgridColor
- color to draw grid with (editor)gridHighlight
- color to use for highlighting grid positiong
- graphics context for calculating font positioning
NullPointerException
- if any of the supplied parameters are
null
.Method Detail |
---|
public void drawTiles(Tile[][] tiles, Point activePos, Point activePos2, Point oldPos, Point player2Start, boolean dualStart, Graphics2D g)
null
if they do not apply.
tiles
- the tiles to renderactivePos
- currently active grid positionactivePos2
- second active position. Used in conjuction with
activePos
to highlight a whole areaoldPos
- specifies previously active position. Only having to
render over the top of one grid position improves performance.player2Start
- location of second playerdualStart
- indicates both players start from the same positiong
- graphics context for drawingpublic void drawGTiles(GameTile[][] tiles, Point activePos, Point activePos2, boolean numbered, Graphics2D g)
null
if they do not apply.
tiles
- the tiles to renderactivePos
- position of first playeractivePos2
- position of second playernumbered
- toggle tile height numbersg
- graphics context for drawingprotected void drawTiles(Tile[][] tiles, Rectangle gridArea, int tileSize, Point activePos, Point activePos2, Point oldPos, Point player2Start, boolean drawP2Start, boolean dualStart, boolean numbered, Graphics2D g)
null
if they do not apply.
tiles
- the tiles to rendergridArea
- absolute location and dimesions of the gridtileSize
- size of each individual grid slotactivePos
- currently active grid positionactivePos2
- second active position. Used in conjuction with
activePos
to highlight a whole areaoldPos
- specifies previously active position. Only having to
render over the top of one grid position improves performance.player2Start
- location of second playerdrawP2Start
- toggle drawing of second player's start position.
Note: Above parameter required to distinguish between players' start
positions.dualStart
- indicates both players start from the same positionnumbered
- toggle tile height numbersg
- graphics context for drawingpublic void drawMenuString(String s, boolean raised, Rectangle location, Graphics2D g)
s
- the string to renderraised
- indicates whether each letter has a 'base' or not.location
- and dimensions for this string.g
- graphics context for drawing.public void drawScoreString(String s, boolean appendCursor, boolean first, int x, int y, Graphics2D g)
drawMenuString
. This is used to draw entries in
the highscore table.
Warning: For optimum performance no checks are performed on any of
the parameters (i.e. this method might not fail gracefully).
s
- the string to renderappendCursor
- indicates whether to add a cursor to the end of the
string.first
- highest score is highlighted.x
- absolute horizontal location to render to.y
- absolute vertical location to render to.g
- graphics context for drawing.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |