/*_|_| 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 */
> ] Their numbers are 664 and 668, the neighbors of the beast...
---
---------------
* Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)
|