com.threerings.tudey.util
Class TilePainter

java.lang.Object
  extended by com.threerings.tudey.util.TilePainter

public class TilePainter
extends Object

Encapsulates the logic used to "paint" ground and wall tiles.


Field Summary
protected  ConfigManager _cfgmgr
          The config manager used to resolve configuration references.
protected  EntryManipulator _manipulator
          The object used to modify the entries.
protected  TudeySceneModel _scene
          The scene into which we paint.
 
Constructor Summary
TilePainter(ConfigManager cfgmgr, TudeySceneModel scene, EntryManipulator manipulator)
          Creates a new tile painter.
 
Method Summary
protected  void addEntry(TudeySceneModel.TileEntry entry, Rectangle region, TudeySceneModel.Paint paint)
          Adds the specified entry, removing any entries underneath it.
protected  void paintFloor(CoordSet coords, ConfigReference<GroundConfig> ground, int elevation)
          Paints floor tiles in the specified region.
 void paintGround(CoordSet coords, ConfigReference<GroundConfig> ground, int elevation)
          Paints the specified coordinates with ground.
 void paintGround(CoordSet coords, ConfigReference<GroundConfig> ground, int elevation, boolean erase, boolean revise)
          Paints the specified coordinates with ground.
 void paintWall(CoordSet coords, ConfigReference<WallConfig> wall, int elevation)
          Paints the specified coordinates with wall.
 void paintWall(CoordSet coords, ConfigReference<WallConfig> wall, int elevation, boolean erase, boolean revise)
          Paints the specified coordinates with wall.
protected  void removeEntries(CoordSet coords)
          Removes all entries intersecting the given coordinates.
protected  void removeEntries(Rectangle region)
          Removes all entries within the specified region.
protected  void updateGroundEdges(CoordSet coords, CoordSet inner, ConfigReference<GroundConfig> ground, int elevation, boolean revise)
          Updates the edge tiles in the specified coordinate set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_cfgmgr

protected ConfigManager _cfgmgr
The config manager used to resolve configuration references.


_scene

protected TudeySceneModel _scene
The scene into which we paint.


_manipulator

protected EntryManipulator _manipulator
The object used to modify the entries.

Constructor Detail

TilePainter

public TilePainter(ConfigManager cfgmgr,
                   TudeySceneModel scene,
                   EntryManipulator manipulator)
Creates a new tile painter.

Method Detail

paintGround

public void paintGround(CoordSet coords,
                        ConfigReference<GroundConfig> ground,
                        int elevation)
Paints the specified coordinates with ground.


paintGround

public void paintGround(CoordSet coords,
                        ConfigReference<GroundConfig> ground,
                        int elevation,
                        boolean erase,
                        boolean revise)
Paints the specified coordinates with ground.

Parameters:
erase - if true, erase the ground within the coordinates.
revise - if true, replace existing tiles with new variants.

paintWall

public void paintWall(CoordSet coords,
                      ConfigReference<WallConfig> wall,
                      int elevation)
Paints the specified coordinates with wall.


paintWall

public void paintWall(CoordSet coords,
                      ConfigReference<WallConfig> wall,
                      int elevation,
                      boolean erase,
                      boolean revise)
Paints the specified coordinates with wall.

Parameters:
erase - if true, erase the wall within the coordinates.
revise - if true, replace existing tiles with new variants.

paintFloor

protected void paintFloor(CoordSet coords,
                          ConfigReference<GroundConfig> ground,
                          int elevation)
Paints floor tiles in the specified region.


updateGroundEdges

protected void updateGroundEdges(CoordSet coords,
                                 CoordSet inner,
                                 ConfigReference<GroundConfig> ground,
                                 int elevation,
                                 boolean revise)
Updates the edge tiles in the specified coordinate set.

Parameters:
inner - the inner region to exclude from the update.

addEntry

protected void addEntry(TudeySceneModel.TileEntry entry,
                        Rectangle region,
                        TudeySceneModel.Paint paint)
Adds the specified entry, removing any entries underneath it.


removeEntries

protected void removeEntries(Rectangle region)
Removes all entries within the specified region.


removeEntries

protected void removeEntries(CoordSet coords)
Removes all entries intersecting the given coordinates.