-
Starting Allegro
Hello there! I am starting allegro and am getting familiarized with it... I am trying to device a structure that holds a dynamically sized (BITMAP*) array. However I get a compile error when I try to build it...
Code:
#include <allegro.h>
#include <cstdio>
class Sprite
{
public:
BITMAP **frames[];
Sprite(){}
Sprite(BITMAP* addFrame, unsigned int size){
frames = new BITMAP*[size];
}
}temp;
error is:
Code:
||=== SpriteClass, Debug ===|
C:\Projects\CodeBlocks\SpriteClass\main.cpp||In constructor `Sprite::Sprite(BITMAP*, unsigned int)':|
C:\Projects\CodeBlocks\SpriteClass\main.cpp|10|error: incompatible types in assignment of `BITMAP**' to `BITMAP**[0u]'|
||=== Build finished: 1 errors, 0 warnings ===|
MINGW as compiler
Any help?
-
BITMAP **frame[] eh? Did you mean to have the array declaration? I betcha didn't. And just because it drives me crazy... devise*
-
Well....to load a bitmap you have to declare a BITMAP pointer like this:
Code:
BITMAP* my_picture = loadbitmap( file to load here );
What I want to do is this:
Code:
(BITMAP*) *frames[size];
So that I can have an array that contains the corresponding frames of a sprite...such as
frames[0] -> 1st Sprite
frames[1] -> 2nd Sprite
frames[2] -> 3rd Sprite
frames[n] -> nth Sprite
-
I gotcha. But you are just kind of going to show how I am not wrong by saying you should be dropping the [].