- public:
- static TileManager* instance() { return instance_ ? instance_ : instance_ = new TileManager(); }
- Tile* get(unsigned int id) { if( id < tiles.size()) { return tiles[id]; } else { return NULL; } }
+ /** Draw a tile on the screen */
+ void draw(DrawingContext& context, const Vector& pos, int layer) const;
+
+ Surface* get_editor_image() const;
+
+ unsigned int getID() const
+ { return id; }
+
+ Uint32 getAttributes() const
+ { return attributes; }
+
+ int getData() const
+ { return data; }
+
+ /// returns the width of the tile in pixels
+ int getWidth() const
+ {
+ if(!images.size())
+ return 0;
+ return images[0]->w;
+ }
+
+ /// returns the height of the tiles in pixels
+ int getHeight() const
+ {
+ if(!images.size())
+ return 0;
+ return images[0]->h;
+ }
+
+protected:
+ friend class TileManager;
+ Tile();
+
+ void load_images(const std::string& tilesetpath);
+
+ /// parses the tile and returns it's id number
+ void parse(const lisp::Lisp& reader);
+ void parse_images(const lisp::Lisp& cur);