X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftile.h;h=692bfe804f31d9b0171f8bd7671d09c03afb3736;hb=546364c9567ef212ea9276201facf73f5ada696a;hp=80de062749a10772d0fb7bc1dbfd8eb52e2fc2b5;hpb=f9c5c22959ac3020274f3be3531d176e413b0220;p=supertux.git diff --git a/src/tile.h b/src/tile.h index 80de06274..692bfe804 100644 --- a/src/tile.h +++ b/src/tile.h @@ -21,17 +21,15 @@ #ifndef TILE_H #define TILE_H -#include -#include #include +#include "SDL.h" +#include "video/surface.h" -#include "screen/texture.h" -#include "globals.h" -#include "lispreader.h" -#include "setup.h" -#include "vector.h" +using namespace SuperTux; +namespace SuperTux { class LispReader; +} /** Tile Class @@ -86,6 +84,9 @@ public: int next_tile; int anim_speed; + + /** This is the angle of the slope. Set to 0, if this is no slope. */ + float slope_angle; /** Draw a tile on the screen: */ static void draw(const Vector& pos, unsigned int c, Uint8 alpha = 255); @@ -107,54 +108,6 @@ public: } }; -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; -}; - -class TileManager -{ - private: - TileManager(); - ~TileManager(); - - std::vector tiles; - static TileManager* instance_ ; - static std::set* tilegroups_; - void load_tileset(std::string filename); - - std::string current_tileset; - - public: - static TileManager* instance() - { return instance_ ? instance_ : instance_ = new TileManager(); } - static void destroy_instance() - { delete instance_; instance_ = 0; } - - void draw_tile(DrawingContext& context, unsigned int id, - const Vector& pos, int layer); - - 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()) - { - return *tiles[id]; - } - else - { - // Never return 0, but return the 0th tile instead so that - // user code doesn't have to check for NULL pointers all over - // the place - return *tiles[0]; - } - } -}; - #endif + +/* EOF */