#include <CSTile.h>
CSTile can only be created thru a loader (CSTileLoader). CSTile are defined by (now ONLY thru) an ini-File, like:
ID "PAC_LEFT_ACTION" IS_REPEATABLE ACTION_INVERSE_ONCE PHASES 0 ANIMATION "animation\\pac_left.ani"
ID - supposed a unique identifier REAPEATABLE - one of: ACTION_NOT_REPEATABLE 0 ACTION_REPEATABLE 1 ACTION_INVERSE_ONCE 2 ACTION_INVERSE_REPEATABLE 3 ACTION_RANDOM 4
PHASES - many phases, each phase is represented by a number the number corresponse to the ANIMATION that is loaded with the ini - file (numbered from top to bottom. NOTE: REAPEATABLE ACTION_INVERSE_ONCE PHASES 0 PHASES 1 PHASES 2 PHASES 3 PHASES 4
gives the same result as: REAPEATABLE ACTION_NOT_REPEATABLE PHASES 0 PHASES 1 PHASES 2 PHASES 3 PHASES 4 PHASES 3 PHASES 2 PHASES 1 PHASES 0
ANIMATION - many animations are possible! describes the animation to be loaded, parameter gives the ini-file for a CSAnimation
Only two methods are really needed: virtual bool next() // if finished and not repeat -> false, true otherwise
Public Member Functions | |
CSTile (const CSTile &tile) | |
unsigned char | getIDChar () |
virtual | ~CSTile () |
virtual std::string | getType () |
unsigned int | getX () |
unsigned int | getY () |
void | setX (unsigned int x) |
void | setY (unsigned int y) |
unsigned int | getWitdh () |
unsigned int | getHeight () |
SDL_Surface * | getScaledTile (double factor) |
void | setMapPosition (unsigned int x, unsigned int y) |
unsigned int | getMapPositionX () |
in pixel of World | |
unsigned int | getMapPositionY () |
in pixel of World | |
int | getTileType () |
int | getSubtype () |
void | setChanged (bool b) |
bool | isChanged () |
virtual bool | next (const CSDisplayParams &displayParams) |
virtual void | display () |
void | setSolid (bool b) |
bool | isSolid () |
void | setSecPerFrame (float secPerFrame) |
AnimationState * | getAnimationState () |
void | scale (int width, int tilesX, int height, int tilesY) |
Static Public Attributes | |
const char * | CLASS = "CSTile" |
|
Definition at line 21 of file CSTile.cpp. References LOG_ENTER, LOG_EXIT, mAnimation, mAnimationState, mId, mIdChar, mIsSolid, mSubtype, and mType.
00022 { 00023 static char *functionName="CSTile"; 00024 LOG_ENTER 00025 initialize(); 00026 00027 // since all Animations are singletons, we can reuse the animation from our parent 00028 mAnimation = tile.mAnimation; 00029 mAnimationState = tile.mAnimationState; 00030 mId = strdup(tile.mId); 00031 mIdChar = tile.mIdChar; 00032 mIsSolid = tile.mIsSolid; 00033 mType = tile.mType; 00034 mSubtype = tile.mSubtype; 00035 LOG_EXIT 00036 } |
|
Definition at line 68 of file CSTile.cpp. References LOG_ENTER, and LOG_EXIT.
|
|
Definition at line 125 of file CSTile.h.
00125 {return mIdChar;}
|
|
Definition at line 129 of file CSTile.h. References CLASS.
00129 {return (std::string) CLASS;} |
|
Definition at line 131 of file CSTile.h. References AnimationState::mXPos. Referenced by CSSprite::checkCollision(), CSSprite::checkCollisionPixels(), CSTileMap::getTileAtPixel(), CSTileMap::getTouchingTiles(), CSTileMap::isBorderTile(), CSTileMap::setTile(), and CSTileMap::update().
00131 {return mAnimationState.mXPos;} |
|
Definition at line 132 of file CSTile.h. References AnimationState::mYPos. Referenced by CSSprite::checkCollision(), CSSprite::checkCollisionPixels(), CSTileMap::getTileAtPixel(), CSTileMap::getTouchingTiles(), CSTileMap::isBorderTile(), and CSTileMap::update().
00132 {return mAnimationState.mYPos;} |
|
Definition at line 133 of file CSTile.h. References AnimationState::mXPos. Referenced by CSTileMap::setOffset(), and CSTileMap::setTile().
00133 {mAnimationState.mXPos = x;} |
|
Definition at line 134 of file CSTile.h. References AnimationState::mYPos. Referenced by CSTileMap::setOffset(), and CSTileMap::setTile().
00134 {mAnimationState.mYPos = y;} |
|
Definition at line 136 of file CSTile.h. References CSAnimation::getMaxX(). Referenced by CSSprite::checkCollision(), CSSprite::checkCollisionPixels(), CSTileMap::getTileAtPixel(), CSTileMap::getTouchingTiles(), CSTileMap::setOffset(), CSTileMap::setTile(), and CSTileMap::update().
00136 {return mAnimation->getMaxX();} |
Here is the call graph for this function:
|
Definition at line 137 of file CSTile.h. References CSAnimation::getMaxY(). Referenced by CSSprite::checkCollision(), CSSprite::checkCollisionPixels(), CSTileMap::getTileAtPixel(), CSTileMap::getTouchingTiles(), CSTileMap::setOffset(), CSTileMap::setTile(), and CSTileMap::update().
00137 {return mAnimation->getMaxY();} |
Here is the call graph for this function:
|
Definition at line 138 of file CSTile.h. References CSAnimation::getScaledAnimation(). Referenced by CSTileMap::getScaledMap().
00139 { 00140 return mAnimation->getScaledAnimation(mAnimationState, factor); 00141 } |
Here is the call graph for this function:
|
Definition at line 143 of file CSTile.h. Referenced by CSTileMap::setTile().
00143 {mMapPosX = x;mMapPosY = y;} |
|
in pixel of World
|
|
in pixel of World
|
|
Definition at line 146 of file CSTile.h.
00146 {return mType;}
|
|
Definition at line 147 of file CSTile.h.
00147 {return mSubtype;}
|
|
Definition at line 148 of file CSTile.h. Referenced by CSTileMap::resetScaledMap(), and CSTileMap::setTile().
00148 {mChanged = b;} |
|
Definition at line 149 of file CSTile.h.
00149 {return mChanged;}
|
|
Definition at line 150 of file CSTile.h. References AnimationState::mDisplayParams, CSAnimation::next(), and CSAnimation::resetState(). Referenced by CSTileMap::update().
00151 { 00152 mAnimationState.mDisplayParams = displayParams; 00153 bool finished = false; 00154 finished = !(mAnimation->next(mAnimationState)); 00155 00156 if (finished) 00157 { 00158 mAnimation->resetState(mAnimationState); 00159 } 00160 00161 return !finished; 00162 } |
Here is the call graph for this function:
|
Definition at line 164 of file CSTile.h. References CSAnimation::display(). Referenced by CSTileMap::display().
00165 { 00166 mAnimation->display(mAnimationState); 00167 } |
Here is the call graph for this function:
|
Definition at line 90 of file CSTile.cpp. References LOG_ENTER, LOG_EXIT, and CSAnimation::setSolid(). Referenced by CSTileSet::setSolid(), and CSTileSet::setTile().
|
Here is the call graph for this function:
|
Definition at line 170 of file CSTile.h.
00170 {return mIsSolid;}
|
|
Definition at line 82 of file CSTile.cpp. References LOG_ENTER, LOG_EXIT, and CSAnimation::setSecPerFrame(). Referenced by CSTileSet::setSecPerFrame(), and CSTileSet::setTile().
00083 { 00084 static char *functionName="setSecPerFrame"; 00085 LOG_ENTER 00086 mAnimation->setSecPerFrame(secPerFrame); 00087 LOG_EXIT 00088 } |
Here is the call graph for this function:
|
Definition at line 172 of file CSTile.h. Referenced by CSSprite::checkCollision(), CSSprite::checkCollisionPixels(), and CSTileMap::getScaledMap().
00172 {return &mAnimationState;}
|
|
Definition at line 126 of file CSTile.cpp. References LOG_ENTER, LOG_EXIT, and CSAnimation::scale(). Referenced by CSTileSet::scaleToFit().
|
Here is the call graph for this function:
|
Definition at line 9 of file CSTile.cpp. Referenced by getType(). |