TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JABO
from: KURT KUZBA
date: 1998-03-15 13:42:00
subject: VESATEST.CPP 2/3

/*_|_|   VESATEST.CPP   PUBLIC DOMAIN   PART 2 OF 3
_|_|_|   Example of using 800x600 and 640x480 VESA modes.
_|_|_|   No warrantee or guarantee.  Kurt Kuzba.  (8/24/1997)*/
/*
   Circle is adapted from Bresnham.C in Bob Stout's SNIPPETS
*/
void Vesamodes::Circle(int xc, int yc, int r,
   int c, int WD = 0, int HG = 0, int dsk = 0)
{
   int x = 0, d = (1 - r) << 1, w;
   HG = HG ? HG : High;
   WD = WD ? WD : Wide;
   w = (WD / HG) << 1;
   if(dsk)
   {
      Disk(xc, yc, r, c, HG, WD);
   }
   else
   {
      while(r >= 0)
      {
         Dot(xc + x, yc + r, c);
         Dot(xc + x, yc - r, c);
         Dot(xc - x, yc + r, c);
         Dot(xc - x, yc - r, c);
         if(d + r > 0)
            d -= (w * --r) - 1;
         if(x > d)
            d += ((++x) << 1) + 1;
      }
   }
}
void Vesamodes::Disk(int xc, int yc, int r, int c, int hg, int wd)
{
   int l, x = 0, d = (1 - r) << 1, w = (wd / hg) << 1;
   while(r >= 0)
   {
      for(l = xc - x; l <= xc + x; l++)
      {
         Dot(l, yc + r, c);
         Dot(l, yc - r, c);
      }
      if(d + r > 0)
         d -= (w * --r) - 1;
      if(x > d)
         d += ((++x) << 1) + 1;
   }
}
void Vesamodes::~Vesamodes(void)
{
   _asm{
      mov ax, 0x03;
      int 10h;
   }
}
int rnd(int m)
{
   return (int)(((long)rand() * ((long)m + 1) - 1) / RAND_MAX);
}
/*_|_|   end   VESATEST.CPP   PUBLIC DOMAIN   PART 2 OF 3   */
> ] I did a Web search for MY MORALS, but didn't find anything..
---
---------------
* Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.