package main; import java.awt.Graphics; import utils.DynamicImage; public class MapImage { int xDrawOffset; int yDrawOffset; int xSortOffset; int ySortOffset; DynamicImage img; MapType type; boolean needsBase; int key; static int lastKey; static { MapImage.lastKey = -1; } public MapImage(final DynamicImage img, final MapType type) { this.xDrawOffset = 0; this.yDrawOffset = 0; this.xSortOffset = 0; this.ySortOffset = 0; this.needsBase = false; this.img = img; this.type = type; ++MapImage.lastKey; this.key = MapImage.lastKey; } public static int nextKey() { return MapImage.lastKey + 1; } public MapType getType() { return this.type; } public DynamicImage getImg() { return this.img; } public int getWidth() { return this.img.getWidth(); } public int getHeight() { return this.img.getHeight(); } public int getXSortOffset() { return this.xSortOffset; } public int getYSortOffset() { return this.ySortOffset; } public void setDrawOffset(final int x, final int y) { this.xDrawOffset = x; this.yDrawOffset = y; } public void setSortOffset(final int x, final int y) { this.xSortOffset = x; this.ySortOffset = y; } public boolean needsBase() { return this.needsBase; } public void setNeedsBase(final boolean needsBase) { this.needsBase = needsBase; } public int getKey() { return this.key; } public void draw(final Graphics g, final int x, final int y) { this.img.draw(g, x + this.xDrawOffset, y + this.yDrawOffset); } public void drawNoOffset(final Graphics g, final int x, final int y) { this.img.draw(g, x, y); } }