Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » d_something_proc

This thread is locked; no one can reply to it. rss feed Print
d_something_proc
chaseC
Member #8,368
February 2007

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
Member #2,559
July 2002
avatar

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

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Johan Halmén
Member #1,550
September 2001

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.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

chaseC
Member #8,368
February 2007

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
Moderator
January 2001
avatar

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.

--
RB
光子「あたしただ…奪う側に回ろうと思っただけよ」
Mitsuko's last words, Battle Royale

chaseC
Member #8,368
February 2007

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
Moderator
January 2001
avatar

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.

--
RB
光子「あたしただ…奪う側に回ろうと思っただけよ」
Mitsuko's last words, Battle Royale

chaseC
Member #8,368
February 2007

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

Go to: