You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
738 B
39 lines
738 B
package mightypork.rogue.world;
|
|
|
|
|
|
import mightypork.util.constraints.rect.Rect;
|
|
import mightypork.util.constraints.rect.builders.TiledRect;
|
|
import mightypork.util.constraints.rect.proxy.RectBound;
|
|
|
|
|
|
public class TileRenderContext implements RectBound {
|
|
|
|
private final TileHolder map;
|
|
private final TiledRect tiler;
|
|
private int x, y;
|
|
|
|
|
|
public TileRenderContext(TileHolder map, Rect mapArea) {
|
|
this.map = map;
|
|
this.tiler = mapArea.tiles(map.getWidth(), map.getHeight());
|
|
}
|
|
|
|
|
|
public TileData getTile()
|
|
{
|
|
return map.getTile(x, y);
|
|
}
|
|
|
|
|
|
public TileData getAdjacentTile(int offsetX, int offsetY)
|
|
{
|
|
return map.getTile(x + offsetX, y + offsetY);
|
|
}
|
|
|
|
|
|
@Override
|
|
public Rect getRect()
|
|
{
|
|
return tiler.tile(x, y);
|
|
}
|
|
}
|
|
|