   Allegro Classes/Bitmap Problem
  Hello all.. I just gotten started into allegro a couple days ago, and I'm trying to build a game engine (to initialize stuff, draw gfx, erase gfx, game cycle, ect..) and everytime I go to test it, it just keeps crashing on me.. In my Character.cpp file (where I created all my methods for my Character Class)) I have this:#include "Character.h"Character::Character(int X, int Y) {x = X;y = Y;speed = 5;img = load_bitmap("guy.bmp",NULL);}void Character::CleanUp() {destroy_bitmap(img);}void Character::GetInput() {if(key[KEY_LEFT]) x -= speed;if(key[KEY_RIGHT]) x += speed;if(key[KEY_UP]) y -= speed;if(key[KEY_DOWN]) y += speed;rest(100);}void Character::DrawGfx() {blit(img,screen,0,0,x,y,10,10);}void Character::EraseGfx() {rectfill(img,x-11,y-11,x+11,y+11,0);}And in my GameEngine File (i'll only post the section where it deals with the game stuff) is this:void GameEngine::GameStart() {while(!key[KEY_ESC]) {GameCycle();rest(30);}GameEnd();}void GameEngine::GameEnd() {box.CleanUp();allegro_exit();}void GameEngine::GameDraw() {box.DrawGfx();}void GameEngine::GameErase() {box.EraseGfx();}void GameEngine::GameCycle() {if(keypressed()) {GameErase();box.GetInput();GameDraw();}}Anyone know why it isnt working?   
  Anyone see my problem, or am I just left here in the dark :(   ;  First guess is that you're calling load_bitmap() before you call set_gfx_mode() ...   ;  A common mistake when using Allegro with C++ is to create an instance of a class before calling allegro_init(). For example:class MyClass{  MyClass()  {    load_bitmap("blah.bmp", NULL);  }};int main(){  MyClass foo; /* boom */  allegro_init();};  Wow thanks alot guys! I'm kinda new at C++ game programming (graphical wise, and input wise), and I guess I thought you only have to initialize it once and it works throughout the whole program :S.. Well anyways thanks again!   ;  You do only initialize Allegro once, but it must be before you use most of its functions. For example:class MyClass{  MyClass()  {    load_bitmap("blah.bmp", NULL);  }};int main(){//  MyClass foo; /* boom */  MyClass *foo;  allegro_init();  foo = new MyClass(); /* ok */}