d_something_proc
chaseC

Hi, I have looked at many examples and I can't figure out how to use the d_..._proc() fuctions. I'm mostly trying to use the d_edit_proc but I can't figure out how to create and display editable text.:'(

CGamesPlay

Look at exdialog.c, in the examples folder of the Allegro source code.

Johan Halmén

You don't run d_something_proc() like you run most functions. You put it in a dialog struct as a function pointer. Instead you run do_dialog() or popup_dialog(), which operates on the struct.

chaseC

Thanks, I got it to work. Now all I need to know though is how to change the text color. All I can get it to do is change shades of blue???

ReyBrujo

Don't use makecol at the array initialization, if you are doing so. You can also post a small sample of your application so that we can help you.

chaseC

here is the part of my program that makes the dialog

1char edittext1[32] = "40";
2char edittext2[32] = "40";
3char edittext3[32] = "5";
4char edittext4[32] = "2";
5char text1[32] = "player 1 paddle: ";
6char text2[32] = "player 2 paddle: ";
7char text3[32] = "game speed: ";
8char text4[32] = "ball size: ";
9char text5[64] = "press escape to go to options";
10DIALOG customoptions[] =
11 {
12 /* (dialog proc) (x) (y) (w) (h)
13 (fg) (bg) (key) (flags)
14 (d1) (d2) (dp) */
15
16 { d_text_proc, 175, 190, 256, 8,
17 500, 0, 0, 0,
18 16, 0, text1 },
19
20 { d_text_proc, 175, 200, 256, 8,
21 500, 0, 0, 0,
22 16, 0, text2 },
23
24 { d_text_proc, 175, 210, 256, 8,
25 500, 0, 0, 0,
26 16, 0, text3 },
27
28 { d_text_proc, 175, 220, 256, 8,
29 500, 0, 0, 0,
30 16, 0, text4 },
31
32 { d_text_proc, 175, 250, 256, 8,
33 500, 0, 0, 0,
34 16, 0, text5 },
35
36 { d_edit_proc, 350, 190, 256, 8,
37 500, 0, 0, 0,
38 16, 0, edittext1 },
39
40 { d_edit_proc, 350, 200, 256, 8,
41 500, 0, 0, 0,
42 16, 0, edittext2 },
43
44 { d_edit_proc, 350, 210, 256, 8,
45 500, 0, 0, 0,
46 16, 0, edittext3 },
47
48 { d_edit_proc, 350, 220, 256, 8,
49 500, 0, 0, 0,
50 16, 0, edittext4 },
51 
52 { NULL, 0, 0, 0, 0,
53 0, 0, 0, 0,
54 0, 0, NULL }
55 };


P.S. I was experimenting with the fg to try and change the color

ReyBrujo

Well, you hardcoded 500 as fg, depending on the color depth you are using, that 500 may be a blue. Just change it (after initializing Allegro, you can use customoptions[0].fg = makecol(64, 0, 0); to change the text1 foreground color to a shade of red.

chaseC

That did the trick, Thanks a lot, I never would have thought of that.;D

Thread #590771. Printed from Allegro.cc