| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Vesatest.c 2/2 |
/*_|_| VESATEST.C ( part 2 of 2 )
_|_|_| A program to test vesa mode 103 (800x600x256).
_|_|_| No guarantee or warrantee given or implied.
_|_|_| PUBLIC DOMAIN by Kurt Kuzba. (8/24/1997)*/
void bresenham_line(int x, int y, int x2, int y2, int c)
{
int i, steep = 0, sx, sy, dx, dy, e, ex, ey;
dx = abs(x2 - x);
sx = ((x2 - x) > 0) ? 1 : -1;
dy = abs(y2 - y);
sy = ((y2 - y) > 0) ? 1 : -1;
if(dy > dx)
{
steep = x; x = y; y = steep; /* swap x and y */
steep = dx; dx = dy; dy = steep; /* swap dx and dy */
steep = sx; sx = sy; sy = steep; /* swap sx and sy */
steep = 1;
}
e = 2 * dy - dx;
ex = dx << 1;
ey = dy << 1;
for(i = 0; i < dx; i++)
{
if(steep)
plotdot(y, x, c);
else
plotdot(x, y, c);
while(e >= 0)
{
y += sy;
e -= ex;
}
x += sx;
e += ey;
}
plotdot(x2, y2, c);
}
void test(void)
{
LineEnds xy[3] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 };
int loop, cc, cl, change, rad;
xy[1].y[1] = rnd(2) + 2; xy[1].x[1] = rnd(2) + 2;
xy[2].x[0] = rnd(2) + 2; xy[2].x[1] = rnd(2) + 2;
xy[2].y[0] = rnd(2) + 2; xy[2].y[1] = rnd(2) + 2;
change = cc = cl = rad = 0;
while(*((char far*)0x0041000aL) == *((char far*)0x0041000cL))
{
if(!change)
{
cl = rnd(255); cc = rnd(255); rad = rnd(80) + 20;
for(loop = 0; loop < 30; loop++)
bresenham_disc(rnd(799), rnd(599), rnd(20) + 20,
rnd(255), rnd(30) + 10, rnd(40) + 10);
}
change = (change + 1) & 511;
for(loop = 0; loop < 2; loop++)
{
if(xy[0].x[loop] < -11) xy[2].x[loop] = rnd(4) + 3;
if(xy[0].x[loop] > 611) xy[2].x[loop] = -(rnd(4) + 3);
if(xy[0].y[loop] < -11) xy[2].y[loop] = rnd(4) + 3;
if(xy[0].y[loop] > 811) xy[2].y[loop] = -(rnd(4) + 3);
xy[0].x[loop] += xy[2].x[loop];
xy[0].y[loop] += xy[2].y[loop];
}
if(xy[1].x[0] < 1) xy[1].x[1] = rnd(4) + 3;
if(xy[1].x[0] > 598) xy[1].x[1] = -(rnd(4) + 3);
if(xy[1].y[0] < 1) xy[1].y[1] = rnd(4) + 3;
if(xy[1].y[0] > 798) xy[1].y[1] = -(rnd(4) + 3);
xy[1].x[0] += xy[1].x[1];
xy[1].y[0] += xy[1].y[1];
bresenham_line(xy[0].y[0], xy[0].x[0], xy[0].y[1],
xy[0].x[1], cl);
bresenham_circle(xy[1].y[0], xy[1].x[0], rad, cc);
}
}
int main(void)
{
time_t TM = time(NULL);
srand((unsigned)TM);
vesamode(0x103);
test();
getch();
Vmode(0x03);
return 0;
}
/*_|_| end VESATEST.C ( part 2 of 2 )*/
> ] * Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728 SEEN-BY: 639/252 670/213 218 @PATH: 154/750 222 396/1 633/260 635/506 728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
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™.