home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Virtual Reality Madness
/
VRMAD96_ONE.ISO
/
virtek
/
libex
/
libex072.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-24
|
2KB
|
59 lines
// Example: 072 from Library Reference
#include "..\3d-ware\dddware.h"
struct ObjectStructure shape1 =
{
0,0,0, // positions : Xpos,Ypos,Zpos
0,0,0, // angles : Xangle,Yangle,Zangle
0, // handle : ShapeHandle
0, // flags : ShapeFlags
DRW_MOBILE }; // draw type : DrawRoutine
struct ObjectStructure shape2 =
{
100,0,0, // position, a little to the right.
0,0,0, // angles
0, // handle
0, // flags
DRW_MOBILE }; // draw type
short myXpos,myYpos;
short main(void)
{
dddInitAll();
shape1.ShapeHandle=shape2.ShapeHandle=dddShapeLoad("EXAMPLE.3D");
dddLookAt16(0,0,0,-16384,0,0,700); // Look from above.
while (dddkeycode!=_ESC)
{
dddCls();
dddClearObjects();
dddQInsertObject(&shape1); // Insert first shape.
dddQInsertObject(&shape2); // Insert second shape.
dddDrawObjects();
if (dddIsCollision(&shape1,&shape2)) // Check for collision.
{
dddMedPrintC(11,10,"COLLISION");
}
else
{
dddMedPrintC(11,10,"NO COLLISION");
}
dddMouseGetRelPointerXy(&myXpos,&myYpos);
if (dddMouseGetButtons())
{ // If button pressed.
shape2.Yangle+=(myXpos)<<4; // Rotate shape2.
}
else
{ // If no buttons pressed.
shape2.Xpos+=(myXpos)<<2; // Move shape2 using.
shape2.Zpos-=(myYpos)<<2; // The mouse.
}
dddScreenSwap();
}
dddRestoreAll();
return 0;
}