|
Bitmap crash |
Matias Persson
Member #15,093
May 2013
|
Hi, I've been messing with a project for some hours now, and I keep getting this bitmap crash, it can't load the bitmap. I've even tried using full path, which doesn't work either. Also, when compiling in release mode I get this weird error on al_wait_for_event(event_queue, &ev), would love to know what is wrong on that one too. Thanks in advance |
RPG Hacker
Member #12,492
January 2011
|
Matias Persson said: potentially uninitialized local pointer variable 'event_queue' used. Well, the error is quite descriptive, if you ask me. You're using a variable that might not have been initialized by the time you're using it. The easiest way to do this is usually something like this (if it's a pointer type): event_queue = NULL; // C style event_queue = nullptr; // C++ style Or like this (if it's a struct and there is no initialize function for it): memset(&event, 0, sizeof(event));
|
Matias Persson
Member #15,093
May 2013
|
Worked perfectly, now there's still just that annoying bitmap crash. |
RPG Hacker
Member #12,492
January 2011
|
background = al_load_bitmap("C:/images/background.png"); What exactly are you trying to load there? Images you're loading in your game shouldn't be just random images somewhere on your disk, they should lie in a subfolder of your game folder. Plus, the image you're referencing here isn't even included in game.rar, the only image included is 00001.png, so no really way for us to test this with your exact image. Wait, nevermind. You already mentioned that you just put in an absolute path to test if that works, so forget what I just said. As for the crash, don't PNG files require some kind of image addon to be initialized? I think that's missing in your code. I'm not sure what the addon was called, but I think it was literally just "image addon" or something like that.
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
He's got al_init_image_addon() in his Initialize function. Try different image files. Try resaving the png with your image editor. It could be a format that isn't recognized. Or, png support might not have been built into your version of allegro. 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 |
RPG Hacker
Member #12,492
January 2011
|
Edgar Reynaldo said: He's got al_init_image_addon() in his Initialize function. Guess I've overlooked that. I saw a bunch of addon initializations, but not this one.
|
Matias Persson
Member #15,093
May 2013
|
I have another project on my drive on the same computer, works fine printing png images. |
GullRaDriel
Member #3,861
September 2003
|
Maybe set the color depth before loading ? "Code is like shit - it only smells if it is not yours" |
Matias Persson
Member #15,093
May 2013
|
I'll try. Edit: Didn't work. |
GullRaDriel
Member #3,861
September 2003
|
Maybe try what they said. Sometimes editors save weird formats. "Code is like shit - it only smells if it is not yours" |
Matias Persson
Member #15,093
May 2013
|
I did all of the things described several times using both different editors and files. |
Wetimer
Member #1,622
November 2001
|
You should setup a debugger and step into al_load_bitmap function to find out what happens. <code>if(Windows.State = Crash) Computer.halt();</code> |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Did you try a format other than png? Where did you get your binaries from? Were they built with png support? 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 |
Matias Persson
Member #15,093
May 2013
|
I've tried other formats than png. |
Matias Persson
Member #15,093
May 2013
|
The last attached project works fine for me too, the one that I attached first is the one that doesn't work. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I successfully loaded and displayed your "Mujaffa Spillet" image 00001.png using Allegro 5.2.0. Can you update to MSVC 2015? Then you can use Nuget to install allegro 5.2. Otherwise you'll have to compile allegro yourself, and that's kind of a nightmare with MSVC. SiegeLord has some build scripts set up to do it for you. You can find them here : 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 |
Matias Persson
Member #15,093
May 2013
|
Perhaps it is time to finally switch IDE? |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Up to you. It looks like there is Nuget for MSVC 2013 available : I can help you setup CodeBlocks, MinGW, and Allegro if you want to make the switch. 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 |
|