Cpp:Building A Simple Tile Engine:Part 3
From GPWiki[edit] Part 3: Creating tiles
This page is far from complete, go ahead and write some more!
You can extend this page by editing it. [edit] File: Tile.h#ifndef TILE_H #define TILE_H #include "Entity.h" /** Tile entity */ class CTile: public CEntity { public: CTile(); virtual ~CTile(); virtual void VThink ( const int& iElapsedTime ); virtual void VRender ( SDL_Surface* pDestSurface ); virtual bool VLoad ( TiXmlElement* pXMLData ); virtual TiXmlElement VGetSaveData(); }; #endif // TILE_H [edit] File: Tile.cpp#include "Tile.h" CTile::CTile() { } CTile::~CTile() { } bool CTile::VLoad( TiXmlElement* pXMLData ) { CEntity::VLoad( pXMLData ); int iTileX = atoi( pXMLData->Attribute( "x" ) ); int iTileY = atoi( pXMLData->Attribute( "y" ) ); SetTile( iTileX, iTileY ); return true; } TiXmlElement CTile::VGetSaveData() { TiXmlElement Tile( "tile" ); Tile.SetAttribute( "x", GetTileX() ); Tile.SetAttribute( "y", GetTileY() ); Tile.InsertEndChild( CEntity::VGetSaveData() ); return Tile; } void CTile::VThink( const int& iElapsedTime ) { CEntity::VThink( iElapsedTime ); } void CTile::VRender( SDL_Surface* pDestSurface ) { CEntity::VRender( pDestSurface ); } Proceed to Part 4: Creating the tile manager
|


