Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » how to get width from sprite?

This thread is locked; no one can reply to it. rss feed Print
how to get width from sprite?
Chaos Maker
Member #12,260
September 2010

how to get the width and height of sprite?

StevenVI
Member #562
July 2000
avatar

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));

__________________________________________________
Skoobalon Software
[ Lander! v2.5 ] [ Zonic the Hog v1.1 ] [ Raid 2 v1.0 ]

Chaos Maker
Member #12,260
September 2010

:D
thank you very much!

Go to: