---sprite.h--- #ifndef SPRITE_H #define SPRITE_H #include enum { SPRITE_CLASSID, }; struct vector { int x; int y; int z; }; class Sprite { public: Sprite(int s_index, int x = 1, int y = 1, int z = 1, int i_lives = 1); virtual ~Sprite(); void redraw(); vector getPosition(void); int getX(); int getY(); int getZ(); void setPosition(vector pos); void setX(int x); void setY(int y); void setZ(int z); virtual void addLives(int num = 1); int getLives(void); bool isAlive(void); virtual bool move(int x, int y, int z = 0); void draw(int x, int y, int z = 0); void erase(int x, int y, int z = 0); protected: vector pos; int classID; int spriteIndex; int numLives; }; #endif -- sprite.cpp --- /*#include "DrawEngine.h"*/ #include "Sprite.h" Sprite::Sprite(int s_index, int x, int y, int z, int i_lives){ pos.x = x; pos.y = y; pos.z = z; spriteIndex = s_index; numLives = i_lives; classID = SPRITE_CLASSID; } Sprite::~Sprite(){ // destroy! } void Sprite::redraw(){ // update the position } vector Sprite::getPosition(void){ return pos; } int Sprite::getX(){ return pos.x; } int Sprite::getY(){ return pos.y; } int Sprite::getZ(){ return pos.z; } void Sprite::setX(int i_x){ pos.x = i_x; } void Sprite::setY(int i_y){ pos.y = i_y; } void Sprite::setZ(int i_z){ pos.z = i_z; } void Sprite::addLives(int num){ numLives += num; } int Sprite::getLives(void){ return numLives; } bool Sprite::isAlive(void){ return (numLives > 0); } bool Sprite::move(int x, int y, int z){ pos.x += x; pos.y += y; pos.z += z; return true; } void Sprite::draw(int x, int y, int z){ // } void Sprite::erase(int x, int y, int z){ } -- main.cpp -- /********************************************************************************* * Includes ********************************************************************************/ #include "main.h" #include "model/Sprite.h" /********************************************************************************* * Program entry point ********************************************************************************/ int main(void) { Sprite bla = new Sprite(1, 1, 1, 1, 1); return 0; }