diff options
Diffstat (limited to 'tools/mapedit/src/object.h')
-rw-r--r-- | tools/mapedit/src/object.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/mapedit/src/object.h b/tools/mapedit/src/object.h new file mode 100644 index 0000000..bfb493c --- /dev/null +++ b/tools/mapedit/src/object.h | |||
@@ -0,0 +1,47 @@ | |||
1 | #ifndef OBJECT_H | ||
2 | #define OBJECT_H | ||
3 | |||
4 | #include <wx/wxprec.h> | ||
5 | |||
6 | #ifndef WX_PRECOMP | ||
7 | #include <wx/wx.h> | ||
8 | #endif | ||
9 | |||
10 | #include <string> | ||
11 | #include <map> | ||
12 | |||
13 | class MapObjectLoadException: public std::exception | ||
14 | { | ||
15 | public: | ||
16 | MapObjectLoadException(std::string mapname) : mapname(mapname) {} | ||
17 | |||
18 | virtual const char* what() const throw() | ||
19 | { | ||
20 | return ("An error occured loading map object " + mapname).c_str(); | ||
21 | } | ||
22 | |||
23 | private: | ||
24 | std::string mapname; | ||
25 | }; | ||
26 | |||
27 | class MapObject { | ||
28 | public: | ||
29 | MapObject(const char* filename); | ||
30 | |||
31 | static const std::map<std::string, std::shared_ptr<MapObject>> getAllObjects(); | ||
32 | |||
33 | std::string getType() const; | ||
34 | wxBitmap getSprite() const; | ||
35 | std::string getAction() const; | ||
36 | int getWidth() const; | ||
37 | int getHeight() const; | ||
38 | |||
39 | private: | ||
40 | std::string type; | ||
41 | wxBitmap sprite; | ||
42 | std::string action; | ||
43 | int width; | ||
44 | int height; | ||
45 | }; | ||
46 | |||
47 | #endif | ||