drawing-area: allow zooming from 8px to 32px, using unique graphics source for each level
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@756 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
ee449d59a4
commit
1ce5080705
3 changed files with 18 additions and 7 deletions
|
@ -29,17 +29,22 @@ public class TileImages
|
|||
this.TILE_WIDTH = size;
|
||||
this.TILE_HEIGHT = size;
|
||||
|
||||
//if (size != 16) {
|
||||
// this.images = loadTileImages("/tiles_"+size+"x"+size+".png", size);
|
||||
//}
|
||||
//else {
|
||||
if (size != 16) {
|
||||
this.images = loadTileImages("/tiles_"+size+"x"+size+".png", size);
|
||||
}
|
||||
else {
|
||||
this.images = loadTileImages("/tiles.png", 16);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
static Map<Integer,TileImages> savedInstances = new HashMap<Integer,TileImages>();
|
||||
|
||||
public static TileImages getInstance(int size)
|
||||
{
|
||||
return new TileImages(size);
|
||||
if (!savedInstances.containsKey(size)) {
|
||||
savedInstances.put(size, new TileImages(size));
|
||||
}
|
||||
return savedInstances.get(size);
|
||||
}
|
||||
|
||||
public Image getTileImage(int cell)
|
||||
|
|
Reference in a new issue