rlgamekit.map.display
Class TiledMapPainter

java.lang.Object
  extended by rlgamekit.map.display.TiledMapPainter

public class TiledMapPainter
extends java.lang.Object

Paint a tiled (cell based) map.


Constructor Summary
TiledMapPainter()
           
 
Method Summary
 java.awt.Dimension calculateMapBounds()
          Calculate the display area needed to display the full map.
 int getCurrentLayer()
           
 void getCursorRectangle(java.awt.Rectangle redrawRect)
           
 java.awt.Point mousePosToTile(int mousex, int mousey)
          Reverse mapping of mouse (screen) coordinate to tile coordinate.
 void paint(java.awt.Graphics gr)
          Paint the map onto a graphics context.
 void setCurrentLayer(int layer)
           
 void setHasTransparentTiles(boolean yesno)
           
 void setLocator(TileLocator tileLocator)
           
 void setMap(LayeredMap map)
           
 void setMark(int x, int y)
           
 void setShowScripts(boolean yesno)
           
 void setTilePainter(TilePainter tilePainter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TiledMapPainter

public TiledMapPainter()
Method Detail

setShowScripts

public void setShowScripts(boolean yesno)

setHasTransparentTiles

public void setHasTransparentTiles(boolean yesno)

setMark

public void setMark(int x,
                    int y)

setMap

public void setMap(LayeredMap map)

setLocator

public void setLocator(TileLocator tileLocator)

setTilePainter

public void setTilePainter(TilePainter tilePainter)

getCurrentLayer

public int getCurrentLayer()

setCurrentLayer

public void setCurrentLayer(int layer)

calculateMapBounds

public java.awt.Dimension calculateMapBounds()
Calculate the display area needed to display the full map.

Returns:
width and height for map display.

getCursorRectangle

public void getCursorRectangle(java.awt.Rectangle redrawRect)

paint

public void paint(java.awt.Graphics gr)
Paint the map onto a graphics context.

Parameters:
gr - Context to paint upon.

mousePosToTile

public java.awt.Point mousePosToTile(int mousex,
                                     int mousey)
Reverse mapping of mouse (screen) coordinate to tile coordinate. Can be used with all sorts of map layouts (rectangular, isometric). This method is not thread safe! Subsequent calls will overwrite the result object data of former calls.

Parameters:
mousex - mouse x position
mousey - mouse y position
Returns:
The tile coordinate where the mouse points to.