Use Allegro BITMAP* in a class

This is a discussion on Use Allegro BITMAP* in a class within the C++ Programming forums, part of the General Programming Boards category; So, im trying to create a class which uses a BITMAP*. I don't want to send a BITMAP to the ...

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    9

    Use Allegro BITMAP* in a class

    So, im trying to create a class which uses a BITMAP*. I don't want to send a BITMAP to the constructor since I want the constructor to load the same image every time. The problem is that when I try to load a bitmap the program crashes. If I create a new bitmap it works as intended.

    Player.h
    Code:
    ...
    BITMAP* mRunningImage;
    BITMAP* mIdleImage;
    ...
    Player.cpp

    Code:
    ...
    Player::Player(double mPos_x, double mPos_y, double mSpeed, int mHelath, int mStamina, int mMaxEggs, int mArmor)
    {
        mRunningImage = load_bitmap("elme_8_dir",NULL); //doesn't work
        mIdleImage = create_bitmap(10,10); //works
        ...
    }
    ...
    How should I write the load_bitmap to make the program not crash?

  2. #2
    Registered User
    Join Date
    Feb 2012
    Posts
    9
    Nvm, I just noticed that Im an idiot......forgot to add ".bmp" to the filename.

    Pls ignore this thread

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Allegro help! EASY LOADING OF BMP class
    By Blizzarddog in forum Game Programming
    Replies: 3
    Last Post: 11-25-2003, 07:50 PM
  2. draw to a BITMAP* argument - allegro and objects again
    By MadHatter in forum Game Programming
    Replies: 13
    Last Post: 12-13-2002, 06:51 AM
  3. allegro timer in a class
    By MadHatter in forum Game Programming
    Replies: 7
    Last Post: 12-06-2002, 10:06 PM
  4. Allegro bitmap collision? how?
    By elfjuice in forum Game Programming
    Replies: 5
    Last Post: 07-06-2002, 12:45 PM
  5. bitmap in allegro
    By pode in forum Game Programming
    Replies: 5
    Last Post: 03-30-2002, 10:06 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21