Is there some support for buttons in allegro? I mean like menu buttons so that I wouldn`t have to check myself if mouse is clicked and propper frame is on top etc.
Tomek, are you talking about the buttons that are found in the allegro examples/exgui example file?
Yes, thanks. It seems to cover all I`ll need. I just wish it would look that complicated (the code)...
EDIT:
I`ve tried to display a single button using the code from that example and I failed.
Here`s the code:
| 1 | |
| 2 | extern int info1(void); |
| 3 | |
| 4 | int my_button_proc(int msg, DIALOG *d, int c) |
| 5 | { |
| 6 | int ret = d_button_proc(msg, d, c); |
| 7 | if (ret == D_CLOSE && d->dp3) |
| 8 | return ((int (*)(void))d->dp3)(); |
| 9 | return ret; |
| 10 | } |
| 11 | |
| 12 | void Manager::MainMenu(){ |
| 13 | DIALOG the_dialog[] ={ |
| 14 | { d_clear_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, |
| 15 | { my_button_proc, 400, 150, 160, 20, 0, 0, 'i', D_EXIT, 0, 0, "&Info", NULL, (void *)info1 }, |
| 16 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } |
| 17 | }; //(*) |
| 18 | do_dialog(the_dialog, -1); |
| 19 | } |
| 20 | |
| 21 | int info1(void) { allegro_message("asasas");} |
In line (*) I get an error: invalid conversion from `const void*' to `void*'
Try to replace (void *)info1 by (const void*)info1.
I`ve done that and this way I get the same error in the same place, except that I get it twice.
I`ve tried to make a rebuild (deleted all non .cpp and non .h files from the dir) and it didn`t help.