home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickDraw3D 1.6 SDK / Mac SampleCode New for 1.6 / ViewerOptBtnSample / Source / Main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-18  |  2.0 KB  |  110 lines  |  [TEXT/CWIE]

  1. /****************************/
  2. /*  VIEWER TEST             */
  3. /* By Brian Greenstone      */
  4. /****************************/
  5.  
  6.  
  7. /****************************/
  8. /*    EXTERNALS             */
  9. /****************************/
  10. #include <AppleEvents.h>
  11. #include <Fonts.h>
  12. #include <MacWindows.h>
  13. #include <Dialogs.h>
  14. #include <Gestalt.h>
  15.  
  16. #include <QD3D.h>
  17. #include <QD3DGeometry.h>
  18.  
  19. #include "myglobals.h"
  20. #include "mymenus.h"
  21. #include "myevents.h"
  22. #include "misc.h"
  23. #include "process.h"
  24.  
  25.  
  26. /****************************/
  27. /*    PROTOTYPES            */
  28. /****************************/
  29.  
  30. static    void ToolBoxInit(void);
  31.  
  32.  
  33. /*****************/
  34. /* TOOLBOX INIT  */
  35. /*****************/
  36.  
  37. static void ToolBoxInit(void)
  38. {
  39. TQ3Status    myStatus;
  40. long response;
  41.  
  42.      MaxApplZone();
  43.     InitGraf(&qd.thePort);
  44.     FlushEvents ( everyEvent, REMOVE_ALL_EVENTS);
  45.     InitFonts();
  46.     InitWindows();
  47.     InitDialogs(nil);
  48.     InitCursor();
  49.     InitMenus();
  50.     TEInit();
  51.     
  52.             /* SEE IF QD3D AVAILABLE */
  53.     
  54.     if((void *)Q3Initialize == (void *)kUnresolvedCFragSymbolAddress)
  55.         DoFatalAlert("\pQuickDraw 3D version 1.6 or better is required to run this application!");
  56.  
  57.     myStatus = Q3Initialize();
  58.     if ( myStatus == kQ3Failure )
  59.         DoFatalAlert("\pQ3Initialize returned failure.");    
  60.         
  61.     Gestalt(gestaltQD3D, &response);
  62.     if (response & (1<<gestaltQD3DPresent))
  63.     {    
  64.         Gestalt(gestaltQD3DVersion,&response);
  65.         if (response < 0x10600)                        // must be using 1.6 or better
  66.         {
  67. err:        
  68.             DoFatalAlert("\pQuickDraw 3D version 1.6 or better is required to run this application!");
  69.         }
  70.     }
  71.     else
  72.         goto err;
  73. }
  74.  
  75.  
  76.  
  77. /*****************/
  78. /* TOOLBOX EXIT  */
  79. /*****************/
  80.  
  81. static void ToolBoxExit(void)
  82. {
  83. TQ3Status    myStatus;
  84.  
  85.     myStatus = Q3Exit();
  86.     if ( myStatus == kQ3Failure )
  87.         DoFatalAlert("\pQ3Exit returned failure.");                
  88. }
  89.  
  90.  
  91. /************************************************************/
  92. /******************** PROGRAM MAIN ENTRY  *******************/
  93. /************************************************************/
  94.  
  95.  
  96. void main(void)
  97. {
  98.     ToolBoxInit();                  
  99.     InitMenuBar();
  100.     InitTest();
  101.  
  102.     while (true)
  103.         HandleEvents();
  104.  
  105.     ToolBoxExit();
  106. }
  107.  
  108.  
  109.  
  110.