home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-25 | 5.7 KB | 112 lines | [TEXT/MMCC] |
- //==============================================================================================\\
- // ------------------------------------------------------------------------------- \\
- // MGWExterns1.h version 1.0.0 copyright © 1993…1995 Jamie McCornack, john calhoun \\
- // ------------------------------------------------------------------------------- \\
- // Constants and prototypes for Macintosh GameWriter 1.0.0, a training program… \\
- // …for beginning Mac game programmers. MGW1 includes MGWUtilities1.c, MGWSound1.c,… \\
- // …MGWGraphics1.c, MGWGraphicsBWLite1.c, HelloWorld.rsrc and an assortment of demo… \\
- // programs; projects HelloWorld1.π etc. and source code files HelloWorld1.c etc. \\
- // A tutorial is available in Tricks of the Mac Game Programming Gurus, published… \\
- // …by Hayden Books \\
- // \\
- // This code is offered by the copyright holders for no fee and for whatever use… \\
- // …you care to make of it, but we do hope you remember where it came from. \\
- // \\
- // Please send bug reports to MacGameDev at America OnLine. macgamedev@aol.com \\
- // Suggestions and observations are also appreciated. \\
- // Updates and upgrades will be available now and then from the above e-mail address. \\
- //==============================================================================================\\
-
-
- //-------------------------------------------------------------- Constants
-
- // for MGWUtilities1.c
- // Assorted resource IDs and string indexes for alerts.
- #define rRedAlertID 1000 // Alert resource constants. Used here because it's easier…
- #define rRedAlertStringIDs 1000 // …to change constants than to rewite routines.
- #define rYellowAlertID 1001 // Alert resource constants. Used here because it's easier…
- #define rYellowAlertStringIDs 1001 // …to change constants than to rewite routines.
- #define kYellowExitItem 4 // The button in Yellow Alert rsrc that signals "quit game."
- #define kErrOldSystem 1 // 'STR#' indicees. You can add more error types to this…
- #define kErrOldMacintosh 2 // …list so long as you add as well an additional string…
- #define kErrLowMemory 3 // …to the red alert 'STR#' resource.
- #define kErrNoResource 4
- #define kErrNoColor 5
- #define kErrNot8BitColor 6
- #define kPref4BitColor 1 // 'STR#' indexes for YellowAlert().
- #define kPref8BitColor 2
- #define kPrefDownTo8BitColor 3
-
- // for MGWSound1.c
- // Assorted Sound Priority constants.
- #define kHighestSoundPriority 100
- #define kHighSoundPriority 80 // We'll define sound priorites from 1 to 100. You
- #define kMediumSoundPriority 50 // can use any integer, but often these predefined
- #define kLowSoundPriority 20 // constatns will do the job. One is the lowest priority
- #define kLowestSoundPriority 1 // we car to use--negative priorities are confusing.
- #define kNoSoundPlaying 0 // Zero is reserved - it indicates "no sound is playing"
-
-
-
- //-------------------------------------------------------------- Prototypes
-
- // for MGWUtilities1.c
- void CenterAlert (short theAlertID); // Centers the alert in the current monitor screen.
- void RedAlert (short whatGives); // Display Alert message, get user ok, exit program.
- void YellowAlert (short whatGives); // Display Alert message, get user choice, exit or…
- // …continue program.
- void RedAlertString (StringPtr theString); // Display Alert message, get ok, exit program.
- void YellowAlertString (StringPtr theString); //Display Alert message, get choice, exit or…
- // …continue program.
- void InitToolbox (void);
- short WhatsOurDepth (void);
-
- // for MGWSound1.c
- // These routines handles environment launch and exit.
- void InitializeForSound(void);
- OSErr CloseDownSound(void);
-
- // These routines handle sound loading at the beginning of the program.
- Boolean LoadASound(short soundID);
- Boolean LoadARangeOfSounds(short firstID, short lastID);
- Boolean LoadAllSounds(void);
-
- // These routines free the memory that the last group locked away. These routines do not relocate
- // or dispose of the sounds, but allow the memory manager to do so if heap space gets tight.
- Boolean ReleaseASound(short soundID);
- Boolean ReleaseARangeOfSounds(short firstID, short lastID);
- Boolean ReleaseAllSounds(void);
-
- // The next group are "utility" routines that give you information about the state of sound.
- Boolean IsSoundOn(void);
- Boolean ASoundIsPlaying(void);
- short SoundPriorityPlaying(void);
- Boolean ThisMacCanPlaySounds(void);
-
- // The last two routines actually play the sound.
- OSErr PlayASound(short soundID, short priority);
- OSErr PlaySynchSound(short soundID, short priority);
-
- // The Feeping Creature routines. Use sparingly.
- OSErr PlayLoopSound(short soundID, short priority);
- OSErr PlayLoopSoundOften(short soundID, short priority, short howManyLoops);
- void AddSoundToQ (short soundID);
-
- // for MGWGraphics1.c
- void CreateOffScreenBitMap (Rect *theRect, GrafPtr *offScreen);
- void CreateOffScreenPixMap (Rect *theRect, CGrafPtr *offScreen);
- void KillOffscreenBitMap (GrafPtr *wasPort);
- void KillOffscreenPixMap (CGrafPtr *wasPort);
- void LoadGraphic (short resID);
- // These routines presume your mainWindow is named…
- void DumpScreenToWork (Rect targetRect); // …mainWindow, and your ofscreen graphics buffer…
- void DumpWorkToScreen (Rect targetRect); // …is named workCPort. Change names as needed.
-
- // for MGWGraphicsBWLite1.c
- void CreateOffScreenBitMapLite (Rect *theRect, GrafPtr *offScreen);
- void LoadGraphicLite (short resID);
-
-
- //------------------------------------------------------------------------------------------\\
- // End MGWExterns1.c \\
- //------------------------------------------------------------------------------------------\\