X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject%2Ftilemap.hpp;h=d67049d7805f748a734b4f45f735f86281df4497;hb=5745d9670262c91e6cd35363fd0d2ec169e7c8a4;hp=e80fb733567550ddc5e93101f3c5a0bc07cbac1e;hpb=fea3446f05e1e7673607b835c269d3e8d1929ab3;p=supertux.git diff --git a/src/object/tilemap.hpp b/src/object/tilemap.hpp index e80fb7335..d67049d78 100644 --- a/src/object/tilemap.hpp +++ b/src/object/tilemap.hpp @@ -39,6 +39,7 @@ class Lisp; class Level; class TileManager; class Tile; +class TileSet; /** * This class is reponsible for drawing the level tiles @@ -46,9 +47,10 @@ class Tile; class TileMap : public GameObject, public Serializable, public ScriptInterface { public: - TileMap(); - TileMap(const lisp::Lisp& reader, TileManager* tile_manager = 0); - TileMap(std::string name, int z_pos, bool solid_, size_t width_, size_t height_); + TileMap(const TileSet *tileset); + TileMap(const lisp::Lisp& reader); + TileMap(const TileSet *tileset, std::string name, int z_pos, bool solid_, + size_t width_, size_t height_); virtual ~TileMap(); virtual void write(lisp::Writer& writer); @@ -88,6 +90,11 @@ public: float get_y_offset() const { return y_offset; } + const Vector& get_movement() const + { + return movement; + } + void set_x_offset(float x_offset) { this->x_offset = x_offset; } @@ -109,6 +116,10 @@ public: const Tile* get_tile(int x, int y) const; /// returns tile at position pos (in world coordinates) const Tile* get_tile_at(const Vector& pos) const; + /// returns tile in row y and column y (of the tilemap) + uint32_t get_tile_id(int x, int y) const; + /// returns tile at position pos (in world coordinates) + uint32_t get_tile_id_at(const Vector& pos) const; void change(int x, int y, uint32_t newtile); @@ -117,11 +128,6 @@ public: /// changes all tiles with the given ID void change_all(uint32_t oldtile, uint32_t newtile); - TileManager* get_tilemanager() const - { - return tilemanager; - } - void set_drawing_effect(DrawingEffect effect) { drawing_effect = effect; @@ -149,11 +155,11 @@ public: float get_alpha(); private: + const TileSet *tileset; + typedef std::vector Tiles; Tiles tiles; -private: - TileManager* tilemanager; bool solid; float speed_x; float speed_y; @@ -161,6 +167,7 @@ private: int z_pos; float x_offset; float y_offset; + Vector movement; /**< The movement that happened last frame */ DrawingEffect drawing_effect; float alpha; /**< requested tilemap opacity */