home *** CD-ROM | disk | FTP | other *** search
- #include <FragLoad.h>
- #include <Types.h>
- #include <Memory.h>
- #include <Quickdraw.h>
- #include <Fonts.h>
- #include <Events.h>
- #include <Menus.h>
- #include <MixedMode.h>
- #include <Windows.h>
- #include <TextEdit.h>
- #include <Dialogs.h>
- #include <OSUtils.h>
- #include <ToolUtils.h>
- #include <Types.h>
- #include <SegLoad.h>
-
- #include "DemoLib.h"
-
- /* Prototypes */
-
- void Initialize(void);
-
- //
- // Main body of program
- //
-
- void main(void)
- {
- long tLong = 0;
-
- Initialize();
-
- Set_DemoValue(tLong);
- Do_Demo();
- tLong = Get_DemoValue();
-
- Set_DemoValue(tLong + 1);
- Do_Demo();
- tLong = Get_DemoValue();
-
- Set_DemoValue(tLong + 1);
- Do_Demo();
- tLong = Get_DemoValue();
-
- Set_DemoValue(tLong + 1);
- Do_Demo();
- tLong = Get_DemoValue();
-
- Set_DemoValue(tLong + 1);
- Do_Demo();
- tLong = Get_DemoValue();
-
- do {} while (!Button());
- }
-
- //
- // Initialize everything for the program, make sure we can run
- //
-
- void Initialize(void)
- {
- WindowPtr mainPtr;
- OSErr error;
- SysEnvRec theWorld;
- Rect windRect;
-
- //
- // Test the computer to be sure we can do color.
- // If not we would crash, which would be bad.
- // If we can’t run, just beep and exit.
- //
-
- error = SysEnvirons(1, &theWorld);
- if (theWorld.hasColorQD == false) {
- SysBeep(50);
- ExitToShell(); /* If no color QD, we must leave. */
- }
-
- /* Initialize all the needed managers. */
- InitGraf(&qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(nil);
- InitCursor();
-
- //
- // To make the Random sequences truly random, we need to make the seed start
- // at a different number. An easy way to do this is to put the current time
- // and date into the seed. Since it is always incrementing the starting seed
- // will always be different. Don’t for each call of Random, or the sequence
- // will no longer be random. Only needed once, here in the init.
- //
- GetDateTime((unsigned long*) &qd.randSeed);
-
- //
- // Make a new window for drawing in, and it must be a color window.
- // The window is full screen size, made smaller to make it more visible.
- //
- windRect = qd.screenBits.bounds;
- InsetRect(&windRect, 50, 50);
- mainPtr = NewCWindow(nil,&windRect,"\pDemoApp",true,documentProc,(WindowPtr) -1,false,0);
-
- SetPort(mainPtr); /* set window to current graf port */
- TextSize(24); /* smaller font for drawing. */
-
- MoveTo(50,50);
- DrawString("\pDemoApp");
- }
-