Original Post
Hi...
Have some problem with this piece of code
SPRITEBASE::SPRITEBASE(char *filename, int frames, bool bitmask = 0) {
SPRITEBASE();
Load(filename, frames, bitmask);
}
//Standard Construction
SPRITEBASE::SPRITEBASE() {
m_Ok = false;
m_SrcRect = new SDL_Rect;
m_SrcRect->h = 0;
m_SrcRect->w = 0;
m_SrcRect->x = 0;
m_SrcRect->y = 0;
}
The problem is that i CAN create a new SPRITEBASE object by calling (On 3 of 4 computers)
SPRITEBASE* SpriteBase = new SPRITEBASE("file.png", 2, 0);
But then when I try to create anohter SPRITEBASE object
SPRITEBASE* SpriteBase2 = new SPRITEBASE("file.png", 2, 0);
It crach
when I try to do
m_SrcRect->h = 5;
But if I create them by this piece of code it works perfect:
SPRITEBASE* SpriteBase = new SPRITEBASE();
SpriteBase->Load("file.png", 2, 0);
SPRITEBASE* SpriteBase2 = new SPRITEBASE();
SpriteBase2->Load("file.png", 2, 0);
Have solved the problem by using a third function that do the Init stuff, InitVars(), but why can''t I do it like this? Is there any limits or is it just me that are crazy enough to think that this should work?