00001 #ifndef KYRA_WORLDMAP_INCLUDED 00002 #define KYRA_WORLDMAP_INCLUDED 00003 00004 #include "krmath.h" 00005 #include "imnode.h" 00006 00007 class KrImage; 00008 class TiXmlNode; 00009 class KrResourceVault; 00010 00011 class KrSquareWorldMap : public KrImNode 00012 { 00013 public: 00014 KrSquareWorldMap( int mapWidth, int mapHeight, 00015 int squareSize ); 00016 00017 virtual ~KrSquareWorldMap(); 00018 00019 void ScreenToMap( int screenX, int screenY, KrVector2T< GlFixed >* map, int window ); 00020 void SetLoc( int x, int y, KrImage* image ); 00021 00022 void MapToObject( int x, int y, KrVector2* object ); 00023 00024 int TileWidth() { return width; } 00025 int TileHeight() { return height; } 00026 KrImage* ImageAt( int x, int y ) { return image[ y*width+x ]; } 00027 00028 void SaveXml( TiXmlNode* parent ); 00029 void LoadXml( TiXmlNode* parent, KrResourceVault* vault ); 00030 00033 void CalcBoundingBox( KrRect* bound ); 00034 00035 00036 private: 00037 int width, height; 00038 int squareSize; 00039 KrImage** image; 00040 KrVector2 max; 00041 }; 00042 00043 #endif 00044