I really need to brush up the OOP skills. I suck at this. (too much PHP OOP ).I have a method in a class called set_bitmap(). It takes a bitmap as a parameter and assigns it to the member variable. Here is the entire class:

Ups. I only copied the class Button include. Now all the headers are there. Sorry about that. Its defined in printer.h, its basically an textout_ex() function but automatically sets RED color and position to center...

Hmm.. Maybe heres the problem. When I used the grabber I was getting the bitmaps from bitmap/ folder and I saved the datafile to the main folder ( / ). I think its a bit small... And no data is there. Only the paths to the data is there!

I did that. And now I know the problem is definitely in the .dat file. Now there are some possibilites why it doesent work. a) My grabber.exe is corrupt, b) I dont know how to use it and c) Im an idiot.

Gonna make some new bitmaps and try again! :p

EDIT: I am currently making bitmaps with PS CS2. I draw something. And then Save As... / Bitmap (.bmp) / 16 bit mode / Save. Is this right? Or is there better way?

That should be fine. I don't want to sound condescending - really - but b) is probably the most likely answer. Though it's been a long time since I used the grabber myself, so I'm probably no better myself.

Now this causes the crash. Because if I comment out ..->set_bitmap() and ->set_coords everything is fine. So the problem IS in the class. Now whats wrong. I cant see the problem. When I use set_bitmap the specified bitmap parameter is assigned to the class variable. Nothing to it. But why is it causing a crash? Or is something else causing it... Anyway to solve this? Its the only thing stopping me from going on.

P.S. This is definetely the part of code causing the problem. The rest of the code is located a few posts up. And no, the DATAFILE is not the culprit. I blipped the contents of it on the screen and it worked...

No, when you have a pointer, you need to make it point to somewhere. Basically, your code is:

Button *BUTTON_START =0xDEADBEEF;
Button *BUTTON_QUIT =0xFEEDF00D;

In other words, unless you point the pointers somewhere, they are pointing to trash, and when you try to execute trash with a BUTTON_START->set_bitmap, if you are lucky your game crashes horribly and closes.

You haven't defined the constructor and destructor in your class. Temporarily, replace Button(); in your class with Button() { } and ~Button(); with ~Button() { } (or just delete them altogether), and it should compile. Note that your constructor should set the bitmap member to NULL, and the destrutor, destroy it, and you should call delete BUTTON_START before finishing Allegro, but for now that should work.

If you get a bunch of undefined Allegro stuff, you forgot to add a reference to Allegro in the linking section of the IDE.

I added the -lalleg already. And BTW: IT WORKS!!! Thanks. Something so simple (well, at least now) and changes so much. Thank you very much. This language is causing me so much agony at the moment.. Thanks for all the support from all the people who replied to this thread and helped! And especially thank you ReyBrujo!