can i set bg img for a dialog
raja peter

hi,

can i set a background image(a bmp or gif) as the background of dialog and display other elements(dialogs) on it.

I tried d_bitmap_proc, but could not draw other objects on it.

thanks.

James Stanley

Is the d_bitmap_proc the first item declared in your dialogue?
If so, then you may have to have a loop that calls update_dialog and draw_sprite...

type568

void blit(BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);

Copies a rectangular area of the source bitmap to the destination bitmap. The source_x and source_y parameters are the top left corner of the area to copy from the source bitmap, and dest_x and dest_y are the corresponding position in the destination bitmap. This routine respects the destination clipping rectangle, and it will also clip if you try to blit from areas outside the source bitmap.

spellcaster

@raja: d_bitmap_proc works. Try

DIALOG dlg[] =
{
   /* (proc)        (x)  (y)  (w)  (h)  (fg) (bg) (key) (flags) (d1) (d2) (dp)            (dp2) (dp3) */
   { d_bitmap_proc, 0,   0,   344, 176, 0,   0,   0,    0,      0,   0,   NULL    NULL, NULL },
   { d_button_proc, 128, 128, 208, 40,  0,   0,   0,    D_EXIT, 0,   0,   "Quit",         NULL, NULL },
   { NULL,          0,   0,   0,   0,   0,   0,   0,    0,      0,   0,   NULL,           NULL, NULL }
};

but make sure to set the dp pointer to the correct bitmap:

dlg[0]->dp = load_image("foo.tga", NULL);

@type568:
While he is showing the dialog, blitting directly won't be of much use.

type568

You mean he wants to stretch it?

spellcaster

No, I mean he wants to use it in an allegro dialog ;)

Thread #591842. Printed from Allegro.cc