Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » why this doesn't work?

This thread is locked; no one can reply to it. rss feed Print
why this doesn't work?
Maikol
Member #4,997
September 2004
avatar

Hi folks! When I run this screen appears black, only the mouse over it. No texts, nor buttons. Why?

int main()
{
        DIALOG dialog[] = {
{ d_clear_proc,0,0,0,0,0,0,0,0,0,0,NULL,NULL,NULL },
{ d_text_proc,20,20,0,0,0,0,0,0,0,0,"hello!",NULL,NULL },
{ NULL,0,0,0,0,0,0,0,0,0,0,NULL,NULL,NULL }
};
allegro_init();
...
do_dialog(dialog,-1);
return 0;
}

Help please! Thanks!

El sabio no dice todo lo que piensa, pero siempre piensa todo lo que dice
Aristóteles

Richard Phipps
Member #1,632
November 2001
avatar

You are not creating a screenmode, so nothing will appear. Check out the gui example that comes with Allegro.

Maikol
Member #4,997
September 2004
avatar

i've already whatched it out; the thing is graphic mode was set up yet.

El sabio no dice todo lo que piensa, pero siempre piensa todo lo que dice
Aristóteles

Neil Walker
Member #210
April 2000
avatar

Quote:

You are not creating a screenmode, so nothing will appear.

I think '...' in his code snippet means the bit where he sets up Allegro :)

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Dustin Dettmer
Member #3,935
October 2003
avatar

Paste the smallest piece of code that compiles and behaves incorrectly.

Maikol
Member #4,997
September 2004
avatar

Well, it's finally worked... don't know why but it was needed this:

gui_fg_color = makecol(0, 0, 0);
gui_mg_color = makecol(255, 0, 0);
gui_bg_color = makecol(200, 240, 200);
set_dialog_color(dialog,gui_fg_color,gui_bg_color);
do_dialog(dialog,-1);

I reviewed the example, copy that and know there appears everything. Thanks anyway!

El sabio no dice todo lo que piensa, pero siempre piensa todo lo que dice
Aristóteles

BAF
Member #2,981
December 2002
avatar

You have ALL zeroes on each line of your dialog code. Some of those numbers specify the colors, and 0 = black, so if everything (bg, fg, etc) is black, your screen will be black.

Go to: