Code: Select all
#include <allegro.h>
class Player {
public:
Player();
~Player();
void animate();
protected:
int frame;
BITMAP *player;
};
Player::Player() {
player = load_bitmap("animatie.bmp", NULL);
frame = 1;
}
Player::~Player() {
}
void Player::animate() {
blit(player, buffer, (60*(4-frame)),0,100,100,(20*frame),20);
}
int main(){
allegro_init();
install_keyboard();
set_color_depth(16);
set_gfx_mode( GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
BITMAP *buffer = create_bitmap(640, 480);
return 0;
}
END_OF_MAIN();
In other words: I'd need to declare buffer again in my Player class, but that doesn't seem quite right. 's There a better solution than that (as it feels like that'd give quite some bugs)?In member function 'void Player::animate();' 'buffer' undeclared (first use this function)