So here's the image class, I fixed all the things said above, its just that right now, I don't know why I should save the filepath because I don't use it... ah well, here it is:
class ImageManager
{
public:
ImageManager ( char *filepath );
~ImageManager ( void );
private:
char *filepath;
int ID;
int get_open_ID ( void );
};
int ImageManager::get_open_ID ( void )
{
int OpenID = 1;
while ( dbImageExist( OpenID ) )
OpenID++;
ID = OpenID;
return OpenID;
}
ImageManager::ImageManager(char *path)
{
dbLoadImage ( path, get_open_ID () );
filepath = path;
}
ImageManager::~ImageManager( void )
{
dbDeleteImage ( ID );
}
So, I'm finishing the Sprite manager and then I will put them to the test xD.
Isocadia
Edit: SpriteManager:
class SpriteManager
{
public:
SpriteManager ( int ImageID, float PosX, float PosY );
~SpriteManager ( void );
private:
int ID;
int OpenID;
float PosX, PosY;
int get_open_ID ( void );
};
int SpriteManager::get_open_ID ( void )
{
OpenID = 1;
while ( dbSpriteExist( OpenID ) )
OpenID++;
ID = OpenID;
return OpenID;
}
SpriteManager::SpriteManager ( int ImageID, float PosX, float PosY )
{
dbSprite ( get_open_ID (), PosX, PosY, ImageID );
}
SpriteManager::~SpriteManager( void )
{
dbDeleteSprite ( ID );
}
Just 1 question: Do I need to delete all my int's and chars in the destructor and how do I declare a class and all its fellow functions in a header file?