I am making a shot'em up game, and now i am programming the weapons. I make a class for a weapon, and the class have an ALLEGRO_BITMAP for the sprite of the shoot. My question is if it's better to load the bitmap one time as a static const member, or loading and destroying it every time the bullet is fired and destroyed.
I had try first without the static member, and it was ok, but now i try the static const way and i get and error:
static const ALLEGRO_BITMAP *sprite = al_load_bitmap("sprites/bullet1.png");
"error C2864: 'Weapon1::sprite' : only static const integral data members can be initialized within a class"
Then i create "sprite" as static, not const, and i initialized it before the main class but i get a memory error:
"Unhandled exception at 0x00000000 in Thunder Force IV.exe: 0xC0000005: Access violation reading location 0x00000000."
static ALLEGRO_BITMAP *sprite;
ALLEGRO_BITMAP *Weapon1::sprite = al_load_bitmap("sprites/bullet1.png");
Thanks for reading, i'm awaiting your help.