Hey people, I was here a while ago learning A4 then I took a short break, I came back just a few days ago and A5 appears to have been out for a bit, I had a look at it and looked at some examples and such, I wanted to see if I could load an image and draw it to the screen so I created a bitmap object and set it to NULL then I tried to assign it an image from my HDD called bob, which is a bitmap image. The problem is when the program runs I get an exception :
First-chance exception at 0x00000000 in AllegroProject.exe: 0xC0000005: Access violation.
Unhandled exception at 0x00000000 in AllegroProject.exe: 0xC0000005: Access violation.
I presume this is because the image assign fails because it can't find my image, I tried quite a few things to get this working, first I tried an absolute path, which did not work, then I put it in the same folder as the .exe that also did not work, I also tried something using the path "hack" someone was calling it although I only partially understood what it was doing and it kept failing at compile so I left it.
So I would really appreciate it if someone could tell me whats wrong with my program.
Line that is the main culprit: al_load_bitmap("bob.bmp");
Please post some source code. Use <code></code> tags.
Call al_init_image_addon() first.
To mat, I just put it in now and it still seems to give exceptions.
You've got it in there twice now, both in the wrong place. Before you use any other allegro functions, call al_init.
Call load bitmap after initializing Allegro, after initializing the image addon, and after creating the display. Use an absolute path until you know for sure it is working.
Also, your test is bogus because you never assign the value of load_bitmap to anything.
Forgive me for how messy and badly done it all is, I done it pretty quickly and didn't see what I had done wrong. I fixed the mistakes (not all of them I'm sure) and now my test code runs and tells me that it cannot initiliaze the image. I used a absolute path too.
The answer is in my previous post.
Edit: And use '/' or '\\' for path separators. A single backslash will cause problems.
Thanks, it was the slashes that were causing the problem.