home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-08-06 | 2.3 KB | 89 lines | [TEXT/MWPS] |
- {----------------------------------------------------------------------
-
- Gamma Fading library originally coded in Think C on 12/17/92 by Matt Slot.
- Gamma Fading library converted to Think Pascal on 7/18/95 by Matthew Mora.
-
- On 8/5/95, Bill Catambay ported the library to CodeWarrior pascal for 68K and PPC,
- and wrote this program to demonstrate the Gamma routines.
-
- Files in project:
-
- NewFader.p - This test program for performing a slow fade out, a fast fade in, and
- then a fast fade out and a slow fade in.
- GammaPaslib.p - The Pascal gamma routines and internal type declarations.
- NewFader.µ.rsrc - Resources for this program.
- NewFader(68K).µ - The 68K CW Pascal project.
- NewFader(PPC).µ - The PPC CW Pascal project.
-
- Bill Catambay - catambay@aol.com
- ----------------------------------------------------------------------}
- Program DoubleFade;
-
- Uses
- SegLoad, Fonts, ToolUtils, Resources, Sound, GammaPaslib;
-
- Const
- buttonClick = 128;
-
- Var
- oe: integer;
- myrect: rect;
- mywindow: windowPtr;
- mypicture: pichandle;
-
- Procedure Toolbox_init;
-
- begin
- InitGraf(@qd.thePort);
- InitFonts;
- InitWindows;
- InitMenus;
- TEinit;
- InitDialogs(nil);
- MaxApplZone;
- InitCursor;
- end;
-
- Procedure Do_sound(snd_id: integer);
-
- Var
- snd: handle;
-
- begin
- snd := GetResource(soundListRsrc,snd_id);
- if snd = NIL then
- exit(Do_sound);
- oe := SndPlay(NIL,sndlisthandle(snd),FALSE);
- ReleaseResource(snd);
- end; { of do_sound }
-
- begin
- Toolbox_init;
- if not IsGammaAvailable then
- exittoshell;
- oe := SetupGammaTools;
- mypicture := GetPicture(128);
- Hlock(Handle(mypicture));
- { Center the window }
- myrect := myPicture^^.picFrame;
- OffsetRect(myRect, (qd.screenBits.bounds.right - myrect.right) div 2,
- (qd.screenBits.bounds.bottom - myrect.bottom) div 2);
- { Slow Fade the screen to black and display the window }
- DelayFadeToBlack(1);
- mywindow := NewCWindow(NIL, myrect, '', TRUE, plainDBox ,pointer(-1), FALSE, 0);
- SetPort(mywindow);
- DrawPicture(mypicture, mypicture^^.picFrame);
- HUnlock(Handle(mypicture));
- ReleaseResource(Handle(mypicture));
- { Fade the screen back in and wait for mouse button }
- FadeFromBlack(2);
- repeat
- until Button;
- Do_sound(buttonClick);
- { Fade the screen to black again, remove the window, then slow fade back in }
- FadeToBlack(2);
- HideWindow(mywindow);
- DelayFadeFromBlack(1);
- oe := DisposeGammaTools;
- end.
-