rlgamekit.map.display
Class GraphicsTilePainter

java.lang.Object
  extended by rlgamekit.map.display.AbstractTilePainter
      extended by rlgamekit.map.display.GraphicsTilePainter
All Implemented Interfaces:
TilePainter

public class GraphicsTilePainter
extends AbstractTilePainter

Paint a graphical tile for a map cell at a specified screen location. Tile sheets must be organized with 8 tiles a row currently.


Field Summary
 
Fields inherited from class rlgamekit.map.display.AbstractTilePainter
viewHeight, viewMap, viewWidth
 
Fields inherited from interface rlgamekit.map.display.TilePainter
VIEW_REMEMBERED, VIEW_VISIBLE
 
Constructor Summary
GraphicsTilePainter()
           
 
Method Summary
 int[] getLetterHeights()
           
 int[] getLetterWidths()
           
 void paint(java.awt.Graphics gr, int xpos, int ypos, int color, int tileNo)
          Paint a tile from the tile sheet at the given location.
 void paint(java.awt.Graphics gr, int layer, int mapX, int mapY, int xpos, int ypos, int tileNo)
          Paint a map element.
 void setLetterOffset(int x, int y)
          Applies a global offset to all painted letters.
protected  void setRGB(int[] rgb)
          If you need a custom color map for your tile sheet, you can subclass the GraphicsTilePainter and supply your color map through this method. make sure to call this before you call stTileSheet()
 void setTileSheet(java.awt.image.BufferedImage tilesheet, int rasterX, int rasterY)
          Set the tiles to be used for drawing.
 
Methods inherited from class rlgamekit.map.display.AbstractTilePainter
setViewMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphicsTilePainter

public GraphicsTilePainter()
Method Detail

setRGB

protected void setRGB(int[] rgb)
If you need a custom color map for your tile sheet, you can subclass the GraphicsTilePainter and supply your color map through this method. make sure to call this before you call stTileSheet()

See Also:
setTileSheet

getLetterWidths

public int[] getLetterWidths()

getLetterHeights

public int[] getLetterHeights()

setLetterOffset

public void setLetterOffset(int x,
                            int y)
Applies a global offset to all painted letters.

Parameters:
x - x offset
y - y offset

setTileSheet

public void setTileSheet(java.awt.image.BufferedImage tilesheet,
                         int rasterX,
                         int rasterY)
Set the tiles to be used for drawing. Tile sheets must be organized with 8 tiles a row currently.

Parameters:
tilesheet - The font to use.
rasterX - x raster size if the tile sheet
rasterY - y raster size if the tile sheet

paint

public void paint(java.awt.Graphics gr,
                  int layer,
                  int mapX,
                  int mapY,
                  int xpos,
                  int ypos,
                  int tileNo)
Description copied from interface: TilePainter
Paint a map element.

Parameters:
gr - The graphics context to paint onto.
layer - The map layer
mapX - The map x coordinate
mapY - The map y coordinate
xpos - The screen x position to draw to
ypos - The screen y position to draw to
tileNo - The tile number to draw

paint

public void paint(java.awt.Graphics gr,
                  int xpos,
                  int ypos,
                  int color,
                  int tileNo)
Paint a tile from the tile sheet at the given location.

Parameters:
gr - Graphics context to use for painting
xpos - x position to paint the tile
ypos - y position to paint the tile
color - color of the tile (use 0 if you want the original colors)
tileNo - no. of the tile to paint.