X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftile.h;h=a94a19c36db043026e75c57410d58b41b3df88f6;hb=157cef71aeb9ae25b7bb90f37dda11bc09329d11;hp=ee6a0f66b2c3721c450656051e0a8f45065f1174;hpb=a5123e6e7071da6d73a1ef0b19bf4acb19981605;p=supertux.git diff --git a/src/tile.h b/src/tile.h index ee6a0f66b..a94a19c36 100644 --- a/src/tile.h +++ b/src/tile.h @@ -21,12 +21,14 @@ #ifndef TILE_H #define TILE_H +#include #include #include #include "texture.h" #include "globals.h" #include "lispreader.h" #include "setup.h" +#include "vector.h" /** Tile Class @@ -43,7 +45,8 @@ public: std::vector editor_images; std::vector filenames; - + std::vector editor_filenames; + /** solid tile that is indestructable by Tux */ bool solid; @@ -56,12 +59,16 @@ public: /** water */ bool water; + /** spike - kills player on contact */ + bool spike; + /** Bonusbox, content is stored in \a data */ bool fullbox; /** Tile is a distro/coin */ bool distro; + /** the level should be finished when touching a goaltile. * if data is 0 then the endsequence should be triggered, if data is 1 * then we can finish the level instantly. @@ -79,10 +86,21 @@ public: /** Draw a tile on the screen: */ static void draw(float x, float y, unsigned int c, Uint8 alpha = 255); + static void draw_stretched(float x, float y, int w, int h, unsigned int c, Uint8 alpha = 255); + + static void draw(const Vector& pos, unsigned int c, Uint8 alpha = 255) + { + draw(pos.x, pos.y, c, alpha); + } }; struct TileGroup { + friend bool operator<(const TileGroup& lhs, const TileGroup& rhs) + { return lhs.name < rhs.name; }; + friend bool operator>(const TileGroup& lhs, const TileGroup& rhs) + { return lhs.name > rhs.name; }; + std::string name; std::vector tiles; }; @@ -95,7 +113,7 @@ class TileManager std::vector tiles; static TileManager* instance_ ; - static std::vector* tilegroups_; + static std::set* tilegroups_; void load_tileset(std::string filename); std::string current_tileset; @@ -104,7 +122,7 @@ class TileManager static TileManager* instance() { return instance_ ? instance_ : instance_ = new TileManager(); } static void destroy_instance() { delete instance_; instance_ = 0; } - static std::vector* tilegroups() { return tilegroups_ ? tilegroups_ : tilegroups_ = new std::vector; } + static std::set* tilegroups() { if(!instance_) { instance_ = new TileManager(); } return tilegroups_ ? tilegroups_ : tilegroups_ = new std::set; } Tile* get(unsigned int id) { if(id < tiles.size()) {