Hi, all in the forum, i wasn't to sure where to post this but its sort of related to GDK,
im playing around with Direct X 9 and testing my functions to GDK in performance wise and such.
but i've come across a problem, im working on sprites at the moments and i've been able to, load, draw but not able to safely unload/release it when im done.
below i've provided the destroy code, sprites structure and error code. if you can point out what im doing wrong and suggest a better way it would be help full.
Code For Releasing The Sprites
void CSprites::DestroySprite ( int sId )
{
//get handle
sSprites *dummy = (sSprites *)SpritesHandle.item(sId);
if (dummy==NULL)return;
//Destroy the sprite
dummy->spritetexture->Release();
//SpritesHandle.set(sId,dummy);
ZeroMemory(&dummy->d3dxImageInfo,sizeof(dummy->d3dxImageInfo));
ZeroMemory(&dummy,sizeof(dummy));
//delete dummy->spritetexture;
SpritesHandle.Remove(sId);
dummy->~sSprites();
delete dummy;
}
Sprites structure
struct sSprites
{ public:
sSprites(); //Constructor
~sSprites(); //Deconstructor
//Variables
D3DXVECTOR2 pos; D3DXVECTOR2 center;
D3DXVECTOR2 size; D3DXVECTOR2 scale;
LPDIRECT3DTEXTURE9 spritetexture;
D3DXIMAGE_INFO d3dxImageInfo;
int active; bool draw;
float rotation; bool exist;
};
Errors
Direct3D9: (ERROR) :Memory Address: 037271dc lAllocID=3476 dwSize=00000170, ReturnAddr=5cf3d5ea (pid=000003c0)
Direct3D9: (ERROR) :Memory Address: 0368c094 lAllocID=3477 dwSize=00000064, ReturnAddr=5cf3d5ea (pid=000003c0)
Direct3D9: (ERROR) :Memory Address: 03727384 lAllocID=3478 dwSize=00000064, ReturnAddr=5cf3d5ea (pid=000003c0)
Direct3D9: (ERROR) :Memory Address: 0372741c lAllocID=3479 dwSize=000000f0, ReturnAddr=5cf3d5ea (pid=000003c0)
Direct3D9: (ERROR) :Memory Address: 03727544 lAllocID=3480 dwSize=000000ac, ReturnAddr=5cf3d5ea (pid=000003c0)
Direct3D9: (ERROR) :Memory Address: 03727624 lAllocID=3481 dwSize=000001a4, ReturnAddr=5cf3d5ea (pid=000003c0)
Direct3D9: (ERROR) :Memory Address: 037277fc lAllocID=3482 dwSize=00000170, ReturnAddr=5cf3d5ea (pid=000003c0)
Direct3D9: (ERROR) :Memory Address: 037279a4 lAllocID=3483 dwSize=00000064, ReturnAddr=5cf3d5ea (pid=000003c0)
Direct3D9: (ERROR) :Memory Address: 03725b44 lAllocID=3484 dwSize=00000064, ReturnAddr=5cf3d5ea (pid=000003c0)
Direct3D9: (ERROR) :Memory Address: 03725d74 lAllocID=3486 dwSize=000000f0, ReturnAddr=5cf3d5ea (pid=000003c0)
Direct3D9: (ERROR) :Memory Address: 03725f1c lAllocID=3488 dwSize=000000ac, ReturnAddr=5cf3d5ea (pid=000003c0)
Direct3D9: (ERROR) :Memory Address: 03729374 lAllocID=3565 dwSize=0000007c, ReturnAddr=5cf5b592 (pid=000003c0)
i cant work out what u've done wrong. i get errors like the one above but more, that was a sample above. can anyone point out to me what im doing wrong?
Problem Solution That Never Fails: "Build A Bridge And Get Over It"