Thread: bitmap in allegro

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    479

    bitmap in allegro

    why doesnt this show
    i found it from a tutorial in the net


    BITMAP *my_pic; //Declare a BITMAP called my_pic

    my_pic = load_bitmap("picture.bmp", NULL); // Load our picture

    i have a bmp picture that i have named picture.bmp

    by the way how will the program find "picture.bmp"

    here is the enyire code:



    #include <allegro.h>
    int main(int argc, char *argv[])
    {
    allegro_init();
    install_keyboard();
    set_color_depth(16);
    set_gfx_mode(GFX_AUTODETECT, 640,480,0,0);
    BITMAP *my_pic;
    my_pic = load_bitmap("picture.bmp", NULL);
    acquire_screen();
    blit(my_pic, screen, 0,0,0,0,50,50);
    blit(my_pic, screen, 50,50,100,100,150,150);
    release_screen();
    readkey();
    destroy_bitmap(my_pic);
    return(0);
    }
    END_OF_MAIN();

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    375
    how will the program find "picture.bmp"
    If no path is specified then the program looks for it in the programs current directory (directory your program is located within). If you placed it in a specific place you may enter the path. Say I put mypic.bmp in the C drive under the pics directory:

    BITMAP *pic
    PALLETE *pal;
    pic = load_bitmap("C:\\pics\\mypic.bmp", pal);

    Will load it up.

    -Justin
    Allegro precompiled Installer for Dev-C++, MSVC, and Borland: http://galileo.spaceports.com/~springs/

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    31

    Thumbs down Hey you cheater

    I know where you got that code from because i learned from that site be 4. to load your bitmap you have to specify the location or put the bitmap in the location where the program is being runed from that way you dont have to specify any locations.
    - Read to Learn, and Learn to Read -

  4. #4
    Unregistered
    Guest

    Question umm....

    I was wondering why do you have both of these in your code..
    blit(my_pic, screen, 0,0,0,0,50,50);
    blit(my_pic, screen, 50,50,100,100,150,150);
    ???

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    375
    He is placing the bitmap in two places.
    Allegro precompiled Installer for Dev-C++, MSVC, and Borland: http://galileo.spaceports.com/~springs/

  6. #6
    don't you have to specify a palette too? try putting

    default_palette

    in place of NULL.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Game Programming FAQ
    By TechWins in forum Game Programming
    Replies: 5
    Last Post: 09-29-2004, 02:00 AM
  2. OpenGL -- Bitmaps
    By HQSneaker in forum Game Programming
    Replies: 14
    Last Post: 09-06-2004, 04:04 PM
  3. double buffering for allegro
    By Leeman_s in forum C++ Programming
    Replies: 6
    Last Post: 09-12-2002, 02:45 PM
  4. Special Allegro Information
    By TechWins in forum Game Programming
    Replies: 12
    Last Post: 08-20-2002, 11:35 PM
  5. Allegro bitmap collision? how?
    By elfjuice in forum Game Programming
    Replies: 5
    Last Post: 07-06-2002, 11:45 AM