/*-------------------------------------------------------------------- * * Author: Jonathan E. Flamm * Start Date: November 10, 1993 * Project: Triangles * File: * Description: * * Update History: * 02-19-94 07:19pm rcs * Added Collision * * $Log: ctriangle.C,v $ Revision 1.1 93/11/17 10:49:12 jef Initial revision * *--------------------------------------------------------------------*/ #include #include "icos.h" #include "shmath.h" #include "shmatrix.h" #include "demo.h" #include "int.h" #include "pad.h" Icosahedron theIcos; Sint16 xmov, ymov, zmov; Vertex rect1[] = { 0, 0, 319, 199, }; Vertex rect2[] = { 84, 25, 238, 182, }; Quad qRect = { COLOR1, 0, 0, 319, 0, 319, 202, 0, 202, }; Quad quad1 = { COLOR1, 0, 0, 20, 5, 30, 35, 0, 30, }; void icosDemo(void) { Int16 xrot = 0; Int16 yrot = 0; Int16 zrot = 0; Int32 val = 0; Int32 odd = TRUE; Int32 away = TRUE; Int32 z = 300; texInit(); myLoadTex(); shInitMatrixStack(); icosInit(); /* Initialize Octahedron routines */ icosCreate( &theIcos, intToFixed(0), intToFixed(0), intToFixed(300), intToFixed(40)); cLTexFill( rect1, &TexTable[0]); sleep(1); swapbuffers(); cLTexFill( rect1, &TexTable[0]); sleep(1); swapbuffers(); do { shClearMatrix(); shMove(theIcos.centerX, theIcos.centerY, intToFixed(z) ); shRotateX(intToFixed(xrot)); shRotateY(intToFixed(yrot)); shRotateZ(intToFixed(zrot)); if ( away ) { z += 5; if (z > 800) away = FALSE; } else { z -= 5; if (z < 300) away = TRUE; } yrot += 5; if (yrot >= 360) yrot -= 360; zrot += 1; if (zrot >= 360) zrot -= 360; icosMove( &theIcos ); icosDraw( &theIcos ); sleep(1); if (odd) { val = padRead(); odd = FALSE; if (val == PAD_UP) { vscroll(1); } else if (val == PAD_DOWN) { vscroll(-1); } else vscroll(0); } else { odd = TRUE; if (val == PAD_UP) { vscroll(2); } else if (val == PAD_DOWN) { vscroll(-2); } } swapbuffers(); cLParTexFill( rect2, &TexTable[0]); } while (1); }