home *** CD-ROM | disk | FTP | other *** search
- // Example: 073 from Library Reference
- #include "..\3d-ware\dddware.h"
-
- struct ObjectStructure16 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 ObjectStructure16 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();
- dddQInsertObject16(&shape1); // Insert first shape.
- dddQInsertObject16(&shape2); // Insert second shape.
- dddDrawObjects();
-
- if (dddIsCollision16(&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;
- }
-