[AD] d_rtext_proc

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Now that we've completed the test of textout and textprintf functions, I
notice that there is a d_text_proc and a d_ctext_proc, but no dialog
function for right-aligning text.  The following function prints text
right-aligned to d->x + d->w.

/* d_rtext_proc:
 *  Simple dialog procedure: draws the text string which is pointed to by dp
 *  using d->x + d->w as the right coordinate of the string.
 */
int d_rtext_proc(int msg, DIALOG *d, int c)
{
   if (msg==MSG_DRAW) {
      int fg = (d->flags & D_DISABLED) ? gui_mg_color : d->fg;
      FONT *oldfont = font;

      if (d->dp2)
         font = d->dp2;

      text_mode(d->bg);
      gui_textout(screen, d->dp, d->x + d->w - gui_strlen(d->dp), d->y, fg,
FALSE);

      font = oldfont;
   }

   return D_O_K;
}

--Chris

============================================================================
Chris La Mantia * chrislm@xxxxxxxxxx * http://home.earthlink.net/~chrislm
Current Project: Infinite Worlds, a CRPG with randomly generated worlds
More info at http://home.earthlink.net/~chrislm/infinite



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/