how to get width from sprite?
Chaos Maker

how to get the width and height of sprite?


In Allegro 4, BITMAP objects have w and h properties:

    BITMAP *myBitmap = load_bitmap("whatever.bmp", null);
    printf("myBitmap width: %d, height: %d", myBitmap->w, myBitmap->h);

In Allegro 5, use the following functions on an ALLEGRO_BITMAP object:

    ALLEGRO_BITMAP *myBitmap = al_create_bitmap(32, 64);
    printf("myBitmap width: %d, height: %d", al_get_bitmap_width(myBitmap), al_get_bitmap_height(myBitmap));

Chaos Maker

thank you very much!

Thread #605719. Printed from