00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef MAP_EDITOR_H
00015 #define MAP_EDITOR_H
00016
00017 #include "../Config.h"
00018 #include "TileSetEditor.h"
00019 #include "EditorTile.h"
00020
00021 #include "../Game/GameMap.h"
00022 #include "../Game/MapLocation.h"
00023 #include "../Parse/ListParser.h"
00024 #include "../Util/Matrix.h"
00025
00026 #include <string>
00027
00028 namespace Editor {
00029 class MapEditor {
00030 public:
00031
00032 MapEditor(const std::string& filename);
00033 ~MapEditor();
00034 void saveMap();
00035 void changeMapName(const std::string& newName);
00036 void draw(SDL_Surface* surf);
00037 void handleMouseClick(SDL_MouseButtonEvent& mouseEvent);
00038 private:
00039
00040 struct WndPos {
00041 static const int TILE_MAT_HORIZ_OFFSET;
00042 static const int TILE_MAT_VERT_OFFSET;
00043 static const int TILE_SET_HORIZ_OFFSET;
00044 static const int TILE_SET_VERT_OFFSET;
00045 };
00046
00047 class EditorTileMatrixReader : public Parse::ParseAction {
00048 public:
00049 EditorTileMatrixReader(MapEditor& ed);
00050 void getValue(std::istream& in);
00051 void finishingAction();
00052 private:
00053 MapEditor& editor;
00054 };
00055
00056 friend class EditorTileMatrixReader;
00057
00058 void toggleStartLoc(int row, int col);
00059 Util::Matrix<EditorTile*> tileMatrix;
00060 TileSetEditor tileSetEd;
00061 std::list<Game::MapLocation*> startLocs;
00062 std::string filename;
00063 Graphics::DrawableAt* startLocPic;
00064 };
00065 };
00066
00067 #endif // ifndef MAP_EDITOR_H
00068