summary refs log tree commit diff stats
path: root/tools/mapedit/src/object.h
blob: bfb493c5804fd853937d2a160eea2e0a2ddc6a27 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef OBJECT_H
#define OBJECT_H

#include <wx/wxprec.h>

#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

#include <string>
#include <map>

class MapObjectLoadException: public std::exception
{
  public:
    MapObjectLoadException(std::string mapname) : mapname(mapname) {}
    
    virtual const char* what() const throw()
    {
      return ("An error occured loading map object " + mapname).c_str();
    }
    
  private:
    std::string mapname;
};

class MapObject {
  public:
    MapObject(const char* filename);
    
    static const std::map<std::string, std::shared_ptr<MapObject>> getAllObjects();
    
    std::string getType() const;
    wxBitmap getSprite() const;
    std::string getAction() const;
    int getWidth() const;
    int getHeight() const;
    
  private:
    std::string type;
    wxBitmap sprite;
    std::string action;
    int width;
    int height;
};

#endif