1 package erland.game.tileadventure.rect;
2
3 import erland.game.tileadventure.*;
4 import erland.game.GameEnvironmentInterface;
5 import erland.util.SubImageHandler;
6
7 import java.awt.*;
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 public class RectEnvironment implements TileGameEnvironmentInterface {
29 private GameEnvironmentInterface environment;
30 private static final int SQUARE_SIZE_X=32;
31 private static final int SQUARE_SIZE_Y=32;
32 private static final int SQUARE_SIZE_Z=8;
33 public RectEnvironment(GameEnvironmentInterface environment) {
34 this.environment = environment;
35 }
36 public BlockContainerData createBlockContainer(int offsetX, int offsetY, int sizeX, int sizeY, int sizeZ, int visibleSizeX, int visibleSizeY) {
37 return new RectBlockContainerData(offsetX, offsetY, 0,0,sizeX,sizeY, sizeZ, SQUARE_SIZE_X, SQUARE_SIZE_Y,SQUARE_SIZE_Z,visibleSizeX,visibleSizeY);
38 }
39
40 public BlockContainerData createBlockContainer(int offsetX, int offsetY, int sizeX, int sizeY, int sizeZ) {
41 return createBlockContainer(offsetX,offsetY,sizeX,sizeY,sizeZ,SQUARE_SIZE_X*sizeX,SQUARE_SIZE_Y*sizeY);
42 }
43
44 public BlockContainerData createRectBlockContainer(int offsetX, int offsetY, int sizeX, int sizeY, int sizeZ) {
45 return createBlockContainer(offsetX,offsetY,sizeX,sizeY,sizeZ);
46 }
47 public SubImageHandler createSubImageHandler(Image image) {
48 if(image==null) {
49 image = environment.getImageCreator().createCompatibleImage(getSubImageWidth()*8,getSubImageHeight()*8,Transparency.BITMASK);
50 }
51 return new SubImageHandler(image,getSubImageWidth(),getSubImageHeight(),8,8);
52 }
53
54 public int getSubImageWidth() {
55 return SQUARE_SIZE_X;
56 }
57
58 public int getSubImageHeight() {
59 return SQUARE_SIZE_Y;
60 }
61
62 public DrawMap createBlockMap() {
63 return new RectDrawMap();
64 }
65
66 public String getTileType() {
67 return "rect";
68 }
69 }