home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Virtual Reality Madness
/
VRMAD96_ONE.ISO
/
virtek
/
libex
/
libex129.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-24
|
2KB
|
38 lines
// Example: 129 from Library Reference
#include "..\3D-Ware\dddware.h"
unsigned short count, i;
// A square box around a point at 0x,0y.
short PolyCoords[]={-25,-25, 25,-25, 25,25, -25,25};
short RotatedPoly[]={2,4, 0,0, 0,0, 0,0, 0,0}; // A DrawPoly structure.
short *Store;
short main(void)
{
dddLoadColors("EXAMPLE.COL"); // Load in the color palette called 'example.col' to 'standardpal'.
dddInitVideo();
dddSetPal(dddstandardpal);
dddInit3d();
for (count=0; count<0xFF00; count+=0x40) // Loop a few times.
{
dddSet2dRotation(count); // Set up the rotation value.
Store=RotatedPoly+2; // Store points at the output area.
dddRotateXY(Store, PolyCoords[0], PolyCoords[1]); // Rotate top left of the box and store result.
Store=RotatedPoly+4;
dddRotateXY(Store, PolyCoords[2], PolyCoords[3]); // Rotate top right of the box and store result.
Store=RotatedPoly+6;
dddRotateXY(Store, PolyCoords[4], PolyCoords[5]); // Rotate bot right of the box and store result.
Store=RotatedPoly+8;
dddRotateXY(Store, PolyCoords[6], PolyCoords[7]); // Rotate bot left of the box and store result.
Store=RotatedPoly+2; // Now we will add on offset to each point.
for (i=0; i<8; i++)
{
Store[i]=Store[i]+100; // Add 100 to each calculated and rotated coordinate.
}
dddCls(); // Clear the logbase screen.
dddDrawPoly(RotatedPoly); // Draw the rotated points.
dddScreenSwap(); // Swap the dummy and real screens.
}
dddRestoreVideo();
dddClose3d();
return 0;
}