Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

CSTileSet Class Reference

#include <CSTileSet.h>


Public Member Functions

 CSTileSet (const CSTileSet &tileSet)
virtual ~CSTileSet ()
virtual std::string getType ()
CSTilegetTile (unsigned char c)
void setSolid (bool b)
void setSecPerFrame (float secPerFrame)
int getTileCount ()
void scaleToFit (int width, int tilesX, int height, int tilesY)
int getFreeTile ()
int getMaxTileSize ()
void setTile (CSTile *tile, unsigned char c)
bool isOneSize ()
int getTileXSize ()
int getTileYSize ()

Static Public Attributes

const char * CLASS = "CSTileSet"


Constructor & Destructor Documentation

CSTileSet::CSTileSet const CSTileSet tileSet  ) 
 

Definition at line 25 of file CSTileSet.cpp.

References LOG_ENTER, LOG_EXIT, mId, mIsOneSize, mIsSolid, mXSize, and mYSize.

00026 {
00027     static char *functionName="CSTileSet";
00028     LOG_ENTER 
00029     initialize();
00030     mId = strdup(set.mId);
00031     mIsSolid = set.mIsSolid;
00032     mIsOneSize = set.mIsOneSize;
00033     mXSize = set.mXSize;
00034     mYSize = set.mYSize;
00035     LOG_EXIT
00036 }

CSTileSet::~CSTileSet  )  [virtual]
 

Definition at line 78 of file CSTileSet.cpp.

References LOG_ENTER, LOG_EXIT, and MAX_TILE.

00079 {
00080     static char *functionName="~CSTileSet";
00081     LOG_ENTER 
00082     if (mId != 0)
00083     {
00084         free(mId);
00085         mId = 0;
00086     }
00087 
00088     for (int i=0; i< MAX_TILE; i++)
00089     {
00090         if (mTiles[i] != 0)
00091         {
00092             delete (mTiles[i]);
00093             mTiles[i] = 0;
00094             mTileCount--;
00095         }
00096     }
00097 
00098     LOG_EXIT
00099 }


Member Function Documentation

virtual std::string CSTileSet::getType  )  [inline, virtual]
 

Definition at line 78 of file CSTileSet.h.

References CLASS.

00078 {return (std::string) CLASS;}

CSTile* CSTileSet::getTile unsigned char  c  )  [inline]
 

Definition at line 80 of file CSTileSet.h.

References SDLMain::shutdown().

Referenced by CSTileMap::setTile().

00081         {
00082             if (mTiles[c] == 0)
00083             {
00084                 SDLMain::shutdown((std::string)"TileSet characters not found in TileSet!", 1);
00085             }
00086             return new CSTile(*mTiles[c]);
00087         }   // return a new Tile -> must be freed by outside!

Here is the call graph for this function:

void CSTileSet::setSolid bool  b  ) 
 

Definition at line 143 of file CSTileSet.cpp.

References LOG_ENTER, LOG_EXIT, MAX_TILE, and CSTile::setSolid().

Referenced by CSTileMap::setSolid().

00144 {
00145     static char *functionName="setSolid";
00146     LOG_ENTER 
00147     mIsSolid = b;
00148     for (int i=0; i< MAX_TILE; i++)
00149     {
00150         if (mTiles[i] != 0)
00151         {
00152             mTiles[i]->setSolid(b);
00153         }
00154     }
00155     LOG_EXIT
00156 }

Here is the call graph for this function:

void CSTileSet::setSecPerFrame float  secPerFrame  ) 
 

Definition at line 158 of file CSTileSet.cpp.

References LOG_ENTER, LOG_EXIT, MAX_TILE, and CSTile::setSecPerFrame().

Referenced by CSTileMap::setSecPerFrame().

00159 {
00160     static char *functionName="setSecPerFrame";
00161     LOG_ENTER 
00162     mSecPerFrame = secPerFrame;
00163     for (int i = 0; i< MAX_TILE; i++)
00164     {
00165         if (mTiles[i] != 0)
00166         {
00167             mTiles[i]->setSecPerFrame(secPerFrame);
00168         }
00169     }
00170     LOG_EXIT
00171 }

Here is the call graph for this function:

int CSTileSet::getTileCount  )  [inline]
 

Definition at line 90 of file CSTileSet.h.

00090 {return mTileCount;}

void CSTileSet::scaleToFit int  width,
int  tilesX,
int  height,
int  tilesY
 

Definition at line 218 of file CSTileSet.cpp.

References LOG_ENTER, LOG_EXIT, MAX_TILE, and CSTile::scale().

Referenced by CSTileMap::scaleMapToFit().

00219 {
00220     static char *functionName="scaleToFit";
00221     LOG_ENTER 
00222     // scaling is experimental!!!
00223     // only for single tile background usage!
00224     if (mTileCount != 1)
00225     {
00226         LOG_EXIT
00227         return;
00228     }
00229     for (int i=0; i< MAX_TILE; i++)
00230     {
00231         if (mTiles[i] != 0)
00232         {
00233             mTiles[i]->scale(width, tilesX, height, tilesY);
00234         }
00235     }
00236     LOG_EXIT
00237 }

Here is the call graph for this function:

int CSTileSet::getFreeTile  ) 
 

Definition at line 102 of file CSTileSet.cpp.

References MAX_TILE.

00103 {
00104     for (int i=0; i< MAX_TILE; i++)
00105     {
00106         if (mTiles[i] == 0)
00107         {
00108             return i;
00109         }
00110     }
00111     return MAX_TILE;
00112 }

int CSTileSet::getMaxTileSize  )  [inline]
 

Definition at line 93 of file CSTileSet.h.

References MAX_TILE.

00093 {return MAX_TILE;}

void CSTileSet::setTile CSTile tile,
unsigned char  c
 

Definition at line 115 of file CSTileSet.cpp.

References CSTile::setSecPerFrame(), and CSTile::setSolid().

00116 {
00117     if (mTiles[c] == 0)
00118     {
00119         if (tile == 0)
00120         {
00121             return;
00122         }
00123         mTiles[c] = tile;
00124         mTileCount++;
00125     }
00126     else
00127     {
00128         mTiles[c] = tile;
00129         if (tile == 0)
00130         {
00131             mTileCount--;
00132         }
00133     }
00134     if (tile != 0)
00135     {
00136         mTiles[c]->setSecPerFrame(mSecPerFrame);
00137         mTiles[c]->setSolid(mIsSolid);
00138         // experimental only for single tile, therefore shouldn't be changed...
00139         // mTiles[c]->scale(mWidth, mTilesX, mHeight, mTilesY);
00140     }
00141 }

Here is the call graph for this function:

bool CSTileSet::isOneSize  )  [inline]
 

Definition at line 95 of file CSTileSet.h.

Referenced by CSTileMap::setTile().

00095 {return mIsOneSize;}

int CSTileSet::getTileXSize  )  [inline]
 

Definition at line 96 of file CSTileSet.h.

Referenced by CSTileMap::setTile().

00096 {return mXSize;}

int CSTileSet::getTileYSize  )  [inline]
 

Definition at line 97 of file CSTileSet.h.

Referenced by CSTileMap::setTile().

00097 {return mYSize;}


Field Documentation

const char * CSTileSet::CLASS = "CSTileSet" [static]
 

Definition at line 12 of file CSTileSet.cpp.

Referenced by getType().


Generated on Wed Jul 14 00:45:18 2004 for CSLib by doxygen 1.3.6