1 package erland.game.tileadventure;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import erland.game.GamePanelHandlerForApplication;
22 import erland.game.GamePanelHandlerApplicationInterface;
23 import erland.game.GamePanelHandler;
24 import erland.game.GamePanelHandlerInterface;
25 import erland.game.tileadventure.rect.RectBlockContainerData;
26 import erland.game.tileadventure.rect.RectDrawMap;
27 import erland.game.tileadventure.rect.RectEnvironment;
28 import erland.game.tileadventure.isodiamond.IsoDiamondBlockContainerData;
29 import erland.game.tileadventure.isodiamond.IsoDiamondDrawMap;
30 import erland.game.tileadventure.isodiamond.IsoDiamondEnvironment;
31 import erland.util.*;
32
33 import java.awt.*;
34
35 /***
36 * This is the main class for the client part of the adventure game
37 */
38 public class TileAdventure extends GamePanelHandlerForApplication implements GamePanelHandlerApplicationInterface {
39 public TileAdventure(String type) {
40 if(type!=null && type.equalsIgnoreCase("isodiamond")) {
41 setCustomEnvironment(new IsoDiamondEnvironment(this));
42 }else {
43 setCustomEnvironment(new RectEnvironment(this));
44 }
45 }
46 /***
47 * Main method that starts the game
48 * @param args hostname username
49 */
50 public static void main(String[] args) {
51 TileAdventure game = new TileAdventure(args.length>0?args[0]:null);
52 GamePanelHandler.run(game,game);
53 System.exit(-1);
54 }
55
56 public DisplayMode[] getDisplayModes()
57 {
58 DisplayMode[] displayModes = new DisplayMode[] {
59 new DisplayMode(640,480,32,0),
60 new DisplayMode(640,480,16,0),
61 new DisplayMode(640,480,8,0)};
62 return displayModes;
63 }
64
65 public void initGames(GamePanelHandlerInterface handler)
66 {
67 StorageInterface jarfile = new JarFileStorage("TileAdventure.xml");
68 StorageInterface file = new FileStorage("TileAdventure.xml");
69 setStorage(new ParameterStorageStringEx(file,jarfile,"tileadventure"));
70 setImageHandler(new ImageHandlerForApplicationJarFile(getScreenHandler().getContainer(),"images"));
71 handler.addPanel("Game","Starting the game",new TileAdventureMain(new TileAdventureModelStandalone()));
72 handler.addPanel("Room edit","Starting the room editor",new RoomMapEditor());
73 handler.addPanel("Tile edit","Starting the tile editor",new MapObjectEditor());
74 handler.addPanel("World edit","Starting the world editor",new WorldMapEditor());
75 handler.addPanel("Anim edit","Starting the animation editor",new AnimationEditor());
76 handler.cheatWord("erland");
77 }
78 }