Projectile::Projectile() : Physic( Physic::hbSphere ) { Image * t = new Image(); t->LoadFromFile("res/projectile.bmp"); t->SetSmooth(false); t->CreateMaskFromColor(Color(255, 0, 255)); p.SetImage(*t); SetSize( t->GetWidth(), t->GetHeight()); p.SetCenter( GetSize().x/2, GetSize().y/2); }
Image * Database::RegisterImage(string path) { map<string, Image*>::iterator it = _dbImage.find(path); if ( it != _dbImage.end() ) // Image exists return it->second; Image * tmp = new Image(); if ( !tmp->LoadFromFile(path) ) // Image couldn't be loaded return 0x00; tmp->CreateMaskFromColor(Color(255, 0, 255)); tmp->SetSmooth(false); _dbImage.insert(pair<string, Image*>(path, tmp)); return tmp; }