|
Crashing program when attempt to draw a bitmap region. |
Brendan.Murrell
Member #15,019
March 2013
|
Using Code::Blocks,MinGW 4.5.0 GNU-GCC compiler on Allegro 5.0.9 //EDIT |
SiegeLord
Member #7,827
October 2006
|
That link does not work. Attach the code to your post, perhaps... "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
atlasc1
Member #15,020
March 2013
|
A couple of things to note:
Allegro has been tried and testing very thoroughly, so it's highly unlikely this is an issue involving Allegro or the operating system specifically. Hope that helps!
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
ProjectV0.5 (his code on Pastebin) Quote:
107 GalagaSprite = al_load_bitmap("E:\\Final Project\\GalagaSprite.bmp");
108 GalagaBackGround1 = al_load_bitmap("E:\\Final Project\\Galaga backgrounds\\Galaga Background1.png");
109 GalagaBackGround2 = al_load_bitmap("E:\\Final Project\\Galaga backgrounds\\Galaga Background2.png");
110 if (!GalagaSprite && !GalagaBackGround1 && !GalagaBackGround2)
111 {
112 GalagaSprite = al_load_bitmap("J:\\Final Project\\GalagaSprite.bmp");
113 GalagaBackGround1 = al_load_bitmap("J:\\Final Project\\Galaga backgrounds\\Galaga Background1.png");
114 GalagaBackGround2 = al_load_bitmap("J:\\Final Project\\Galaga backgrounds\\Galaga Background2.png");
115 }
116 else
117 cout << "A Bitmap failed a load!" << endl;
Yes, atlasc1 is right - don't use absolute paths. And don't use windows path separators either, use a single forward slash like in Linux. ALLEGRO_BITMAP* GalagaSprite = al_load_bitmap("Galaga Backgrounds/GalagaSprite.bmp"); if (!GalagaSprite) {cout << "failed to load GalagaSprite" << endl;} // repeat for each bitmap to load. And you would make sure that your exe is in the same folder as the Galaga Backgrounds folder, and that you have set the current working directory to that folder as well. See al_get_standard_path and al_change_directory for details. Use ALLEGRO_RESOURCES_PATH to get the path. And one final note, al_draw_bitmap_region won't fail unless your pointer is null or you destroyed it and then tried to draw it again. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
pkrcel
Member #14,001
February 2012
|
Given the boundary conditions you gave us, I also vote for a failure in loading the images, failre that you do not trap. Alas, you are checking return values...but in the bitter case you fail to load you just print out to the console and go on...nah, it's not safe...program should terminate with an error message. You may very well NOT have console window open in release mode, IIRC. It is unlikely that Google shares your distaste for capitalism. - Derezo |
|