// BUG - loading the same mask file over and over void Sprite::loadFrames(LOADFRAMES& imageFrames) { for( unsigned int i=0; i< imageFrames.size(); ++i) { Bitmap* mask = NULL; Bitmap* img = new Bitmap; img->LoadFromFile(m_hInst, imageFrames[i]->m_imgFile); if(imageFrames[i]->m_imgMaskFile) { mask = new Bitmap; mask->LoadFromFile(m_hInst, imageFrames[i]->m_imgMaskFile); } Frame* frame = new Frame(img, mask); m_frames.push_back(frame); } }
Bitmap *LoadFromFile(const char *filename) { Bitmap *bitmap = new Bitmap(); if (!bitmap->LoadFromFile(filename)) { delete bitmap; bitmap = NULL; } return bitmap; }