home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Book Chapters / 09 - QuickDraw 3D / Mesh / main.c next >
Encoding:
C/C++ Source or Header  |  1995-03-12  |  1.7 KB  |  97 lines  |  [TEXT/MPCC]

  1. /****************************/
  2. /*            MAIN.C            */
  3. /****************************/
  4.  
  5.  
  6. /****************************/
  7. /*    EXTERNALS             */
  8. /****************************/
  9.  
  10. #include <qd3d.h>
  11.  
  12. /****************************/
  13. /*    PROTOTYPES            */
  14. /****************************/
  15.  
  16. extern    void InitMyScene(void);
  17. extern    void DrawMyObjects(void);
  18.  
  19. void main(void);
  20. void DoFatalAlert(Str255 s);
  21. void ToolBoxInit(void);
  22.  
  23.  
  24. /****************************/
  25. /*    CONSTANTS             */
  26. /****************************/
  27.  
  28. #define        ERROR_ALERT_ID        401
  29.  
  30.  
  31. /****************************/
  32. /*    VARIABLES             */
  33. /****************************/
  34.  
  35.  
  36.  
  37. /*********************** DO FATAL ALERT *******************/
  38.  
  39. void DoFatalAlert(Str255 s)
  40. {
  41.     ParamText(s,nil,nil,nil);
  42.     NoteAlert(ERROR_ALERT_ID,nil);
  43.     Q3Exit();                            // unload qd3d
  44.     ExitToShell();
  45. }
  46.  
  47.  
  48. /************ TOOLBOX INIT ************/
  49. //
  50. // Get the Mac up & running, then init QuickDraw 3D
  51. //
  52.  
  53. void ToolBoxInit(void)
  54. {
  55. TQ3Status    myStatus;
  56.  
  57.      MaxApplZone();
  58.     InitGraf(&qd.thePort);
  59.     FlushEvents ( everyEvent, 0);
  60.     InitFonts();
  61.     InitWindows();
  62.     InitDialogs(nil);
  63.     InitCursor();
  64.     InitMenus();
  65.     TEInit();
  66.     
  67.         /* Initialize Escher */
  68.         
  69.     myStatus = Q3Initialize();
  70.     if ( myStatus == kQ3Failure )
  71.         DebugStr("\pQ3Initialize returned failure!");
  72. }
  73.  
  74.  
  75.  
  76. /************************************************************/
  77. /******************** PROGRAM MAIN ENTRY  *******************/
  78. /************************************************************/
  79.  
  80.  
  81. void main(void)
  82. {
  83.     ToolBoxInit();
  84.          
  85.     InitMyScene();            // init the scene
  86.     DrawMyObjects();        // draw the scene
  87.         
  88.     while(!Button());        // wait for mouse click
  89.         
  90.     Q3Exit();                // unload qd3d
  91.     FlushEvents ( everyEvent, 0);
  92.     ExitToShell();
  93. }
  94.  
  95.  
  96.  
  97.