IsValid If the bitmap isn't loaded yet, the loading has failed or the bitmap is already destroyed this function will return false. The Bitmap class also has a conversion to bool operator so you can check the validity of a Bitmap simply by doing: if( !bmp ) Examples Bitmap myBmp( "Gfx/Picture.png" );
// Check if the Bitmap was correctly loaded // if( !myBmp.IsValid() ) { allegro_message( "Couldn't load Picture.png!" ); exit( -1 ); } // Also works and is faster to type // if( !myBmp ) { allegro_message( "Couldn't load Picture.png!" ); exit( -1 ); } Other functions of the class Bitmap
Questions about IsValid? Click here. |