Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » can i set bg img for a dialog

This thread is locked; no one can reply to it. rss feed Print
can i set bg img for a dialog
raja peter
Member #7,835
October 2006

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.

luv,

raja

James Stanley
Member #7,275
May 2006
avatar

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
Member #8,381
March 2007
avatar

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
Member #1,493
September 2001
avatar

@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.

--
There are no stupid questions, but there are a lot of inquisitive idiots.

type568
Member #8,381
March 2007
avatar

You mean he wants to stretch it?

spellcaster
Member #1,493
September 2001
avatar

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

--
There are no stupid questions, but there are a lot of inquisitive idiots.

Go to: