RTS2D
|
00001 #ifndef TILEPROPERTY_H 00002 #include <cstdio> 00003 #include <map> 00004 #include "allegro5/allegro.h" 00005 #define TILEPROPERTY_H 00006 00007 enum TILE_TYPE {GRASS, TREE, GOLD, t_count}; 00011 class TileProperty { 00012 public: 00013 static TileProperty* getInstance() { 00014 if (instance == NULL) { 00015 instance = new TileProperty(); 00016 } 00017 return instance; 00018 } 00019 virtual ~TileProperty(); 00020 void loadTileType(); 00021 void loadChar(); 00022 void loadWalkable(); 00023 void loadBitmap(); 00024 00025 int getTileType(int type); 00026 char getChar(int type); 00027 bool isWalkable(int type); 00028 ALLEGRO_BITMAP* getBitmap(int type); 00029 int getType(char c); 00030 00031 protected: 00032 private: 00033 TileProperty(); 00034 static TileProperty* instance; 00035 std::map <int,int> tileType_; 00036 std::map <int,char> char_; 00037 std::map <int,bool> walkable_; 00038 std::map <int,ALLEGRO_BITMAP*> bitmap_; 00039 }; 00040 00041 #endif // TILEPROPERTY_H