Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Darn GUI

This thread is locked; no one can reply to it. rss feed Print
Darn GUI
Zaphos
Member #1,468
August 2001

The GUI code doesn't seem to like C++ ... It says

Quote:

128 game.cpp
initialization to `void *' from `const char *' discards qualifiers

whenever I try to create a DIALOG object. How does one make the gui work?

Here's the code I was using:

1// Make a dialog for this
2DIALOG the_dialog[] =
3{
4 /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */
5 { d_clear_proc, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, NULL, NULL, NULL },
6 // { d_edit_proc, 32, 32, 256, 8, 255, 0, 0, 0, sizeof(the_string)-1, 0, the_string, NULL, NULL },
7 { d_check_proc, 32, 64, 89, 13, 255, 0, 't', 0, 0, 0, "&Vsync?", NULL, NULL },
8 { d_button_proc, 120, 160, 81, 17, 255, 0, 0, D_EXIT, 0, 0, "Continue", NULL, NULL },
9 { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }
10};
11 
12void Game::get_settings(char *name)
13{
14 
15 for (int item = 0; the_dialog[item].proc; item++) {
16 the_dialog[item].fg = makecol(0, 0, 0);
17 the_dialog[item].bg = makecol(255, 255, 255);
18 }
19 
20 do_dialog(the_dialog, -1);
21}

It isn't complete at all, that was just code I stole from excustom.c to see if I could get anything at all to work. Oh yeah, and the line the error is complaining about is the line with }; at the end of the global DIALOG initialization.

dudaskank
Member #561
July 2000
avatar

Put (void *) before the strings:

DIALOG the_dialog[] =
{
  /* (dialog proc)     (x)   (y)   (w)   (h)   (fg)  (bg)  (key) (flags)  (d1)                    (d2)  (dp)           (dp2) (dp3) */
  { d_clear_proc,      0,    0,    0,    0,    255,  0,    0,    0,       0,                      0,    NULL,          NULL, NULL  },
//  { d_edit_proc,       32,   32,   256,  8,    255,  0,    0,    0,       sizeof(the_string)-1,   0,    the_string,    NULL, NULL  },
  { d_check_proc,      32,   64,   89,   13,   255,  0,    't',  0,       0,                      0,    (void *)"&Vsync?",  NULL, NULL  },
  { d_button_proc,     120,  160,  81,   17,   255,  0,    0,    D_EXIT,  0,                      0,    (void *)"Continue",        NULL, NULL  },
  { NULL,              0,    0,    0,    0,    0,    0,    0,    0,       0,                      0,    NULL,          NULL, NULL  }
};

^__^

Toque a balada do amor inabalável, eterna love song de nós dois
Eduardo "Dudaskank"
[ Home Page (ptbr) | Blog (ptbr) | Tetris 1.1 (ptbr) | Resta Um (ptbr) | MJpgAlleg 2.3 ]

Zaphos
Member #1,468
August 2001

Sweet! It works! ;D
Thank you kindly!

Go to: