fix texture leak

This commit is contained in:
Glenn Maynard
2003-06-21 22:24:48 +00:00
parent d3f3dea59a
commit cd52bc41ac
2 changed files with 16 additions and 0 deletions
+14
View File
@@ -22,6 +22,11 @@ AnimatedTexture::AnimatedTexture()
fSecsIntoFrame = 0;
}
AnimatedTexture::~AnimatedTexture()
{
Unload();
}
void AnimatedTexture::Load( CString sTexOrIniPath )
{
ASSERT( vFrames.empty() ); // don't load more than once
@@ -107,3 +112,12 @@ int AnimatedTexture::GetNumStates()
{
return vFrames.size();
}
void AnimatedTexture::Unload()
{
for(unsigned i = 0; i < vFrames.size(); ++i)
TEXTUREMAN->UnloadTexture(vFrames[i].pTexture);
vFrames.clear();
iCurState = 0;
fSecsIntoFrame = 0;
}