So, nearing the end of my map editor project, I'm met with a problem when i have to "slap on top" of the project the GUI.
There's the map on the left, in a bitmap (typical d_bitmap_proc) an there's the tiles on the right (at the moment, no another d_bitmap_proc), which the user presses and then he "paints" them on the map. In earlier versions, this worked out fine by clearing the screen, painting all the possible 256 tiles and then finding out he tile the user selected using the mouse_x / y the moment he clicked. But now the allegro gui does resicing and its quite "dirty "to do it, cause it's not 32 x 32 tiles anymore.
So far I've thought of the folowing solutions:
- Even if it's dirty, and evil, calculate which tile is the user pressing, even thought the rounding up of numbers may cause a pixel or 2 to be in the wrong tile.
- Make a dialog with 256 d_icon_proc's. Not my favorite cause of the ridiculous amount of work for something so simple, and also cause several icons may be pressed at the same time and there fore it would need extra work to make sure its the tile we want.
- Make some kind of universal d_icon_proc, using a "For" somewere for the 256 cases. The problem here is that first I'm not sure i could do something like that, and even if it could be done, i have no idea how to do it.
I'd love to hear any suggestions and/or explanations on how to do it, cause I'm sure there's been many map editors since the world came to life and most of them must have solved this one way or another.
Please bear with me, its my first C++ and allegro project and it's been less than 4 dais since i started with GUI's so don't assume i know what you're talking about, cause i might disappoint you
Cheers and thxs!!!