Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>fg_adjustxy</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
fg_adjustxy

Usage

   #include <fg.h>

   void far fg_adjustxy (int rot, int n, fg_coord_t far *px,
                         fg_coord_t far *py, fg_const_pbox_t box);

Description

   The x or y coordinate for the next character (or object bounded by box)
   is calculated depending on the rotation rot, which must be one of the
   constants FG_ROT0, FG_ROT90, FG_ROT180 or FG_ROT270. *px and *py are
   pointers to the coordinates of the starting location of first character
   in the string and are adjusted to be where the next character (object)
   would go. The argument n is the number of chars or objects already
   output. This function is most useful with fg_drawmatrix and fg_puts.

Example 


   {
       static char test_string[] = "This is a test.";
       fg_coord_t x, y;
       .

       .
       .
       x = fg.displaybox[FG_X1] + fg.displaybox[FG_X2];
       x -= sizeof(test_string) * (fg.charbox[FG_X2] + 1);
       x /= 2;
       y = (fg.displaybox[FG_Y1] + fg.displaybox[FG_Y2])/2;

       fg_puts(FG_WHITE, FG_MODE_SET, ~0, FG_ROT0, x, y,
                test_string, fg.displaybox);

       fg_adjustxy(FG_ROT0, sizeof(test_string) - 1, &x,
                      &y, fg.charbox);
       /* x and y now are located at the  */
       /* end of the string "test string" */
   }





Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson