View Javadoc

1   package erland.game.tileadventure;
2   
3   import java.awt.*;
4   
5   /*
6    * Copyright (C) 2004 Erland Isaksson (erland_i@hotmail.com)
7    *
8    * This program is free software; you can redistribute it and/or
9    * modify it under the terms of the GNU General Public License
10   * as published by the Free Software Foundation; either version 2
11   * of the License, or (at your option) any later version.
12   *
13   * This program is distributed in the hope that it will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   * GNU General Public License for more details.
17   *
18   * You should have received a copy of the GNU General Public License
19   * along with this program; if not, write to the Free Software
20   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21   * 
22   */
23  
24  public class RoomMapEditor extends TileMapEditor {
25      /*** The draw map implementation to use */
26      protected DrawMap drawMap;
27      /*** The level manager to use */
28      protected LevelManager levelManager;
29      /*** The level manager to use for palette bitmap */
30      protected LevelManager paletteLevelManager;
31      /*** The palette bitmap */
32      protected Image paletteBitmap;
33  
34      protected String getLevelFileLabel() {
35          return null;  //To change body of implemented methods use File | Settings | File Templates.
36      }
37  
38      protected String getLevelFileGroupLabel() {
39          return null;  //To change body of implemented methods use File | Settings | File Templates.
40      }
41  
42      protected int getSizeX() {
43          return 10;
44      }
45  
46      protected int getSizeY() {
47          return 10;
48      }
49      protected int getSizeZ() {
50          return 10;
51      }
52  
53      protected int getSelectSizeX() {
54          return 2;
55      }
56  
57      protected int getSelectSizeY() {
58          return 10;
59      }
60  
61      protected Image getMapBlockImage() {
62          if(paletteBitmap==null) {
63              paletteBitmap = paletteLevelManager.getImage();
64          }
65          return paletteBitmap;
66      }
67  
68      public void drawMapBlocks(Graphics g, MapObjectContainerInterface blocks) {
69          drawMap.setContainer(getMapContainer());
70          drawMap.removeAllObjectMaps();
71          drawMap.addObjectMap(blocks);
72          drawMap.draw(g);
73      }
74  
75      protected LevelManager getLevelManager()
76      {
77          levelManager.setContainer(getMapContainer());
78          return levelManager;
79      }
80  
81      protected void initFinish() {
82          super.initFinish();
83          drawMap = ((TileGameEnvironmentInterface)getEnvironment().getCustomEnvironment()).createBlockMap();
84          levelManager = new RoomEditorLevelManager();
85          levelManager.init(getEnvironment());
86          paletteLevelManager = new MapObjectEditorLevelManager();
87          paletteLevelManager.init(getEnvironment());
88          paletteBitmap = null;
89      }
90  }