home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 2 / MacMania 2.toast / Demo's / Tools&Utilities / Programming / AD Programmer package / Programming Examples / Generic in Pascal / Generic Module.p < prev    next >
Encoding:
Text File  |  1991-06-03  |  1.8 KB  |  76 lines  |  [TEXT/PJMM]

  1. {Generic Graphics Module}
  2.  
  3. {A very simple graphics module for After Dark™}
  4. { This source file can be used as is for both Think Pascal 4.0 and MPW Pascal 3.0  }
  5. { by Patrick Beard and Bruce Burkhalter  }
  6. { © 1989, 90, 91 Berkeley Systems Inc . }
  7.  
  8. unit GraphicsDemo;
  9.  
  10. interface
  11.  
  12.     uses
  13.         Quickdraw, Sound, GraphicsModuleTypes;
  14.  
  15.     function DoInitialize (var storage: Handle; blankRgn: rgnHandle; params: GMParamBlockPtr): OSErr;
  16.  
  17.     function DoBlank (storage: Handle; blankRgn: rgnHandle; params: GMParamBlockPtr): OSErr;
  18.  
  19.     function DoDrawFrame (storage: Handle; blankRgn: rgnHandle; params: GMParamBlockPtr): OSErr;
  20.  
  21.     function DoClose (storage: Handle; blankRgn: RgnHandle; params: GMParamBlockPtr): OSErr;
  22.  
  23.     function DoSetup (blankRgn: rgnHandle; message: integer; params: GMParamBlockPtr): OSErr;
  24.  
  25. implementation
  26.  
  27.     function DoInitialize (var storage: Handle; blankRgn: rgnHandle; params: GMParamBlockPtr): OSErr;
  28.     begin
  29.  
  30. {Allocate memory and initialize variables here}
  31.  
  32.         DoInitialize := noErr;
  33.  
  34.     end;
  35.  
  36.     function DoBlank (storage: Handle; blankRgn: rgnHandle; params: GMParamBlockPtr): OSErr;
  37.  
  38.     begin
  39.  
  40. {Blank the screen.  You could also have "credits" appear on the screen here}
  41.  
  42.         FillRgn(blankRgn, params^.qdGlobalsCopy^.qdBlack);
  43.         DoBlank := noErr;
  44.  
  45.     end;
  46.  
  47.  
  48.     function DoDrawFrame (storage: Handle; blankRgn: rgnHandle; params: GMParamBlockPtr): OSErr;
  49.  
  50.     begin
  51.  
  52. {This function is repeatedly called by After Dark.  This is where the main drawing is done.}
  53.  
  54.         DoDrawFrame := noErr;
  55.  
  56.     end;
  57.  
  58.     function DoClose (storage: Handle; blankRgn: RgnHandle; params: GMParamBlockPtr): OSErr;
  59.     begin
  60.  
  61. {Deallocate your memory here.  You can also put something on the screen.}
  62.  
  63.         DoClose := noErr;
  64.  
  65.     end;
  66.  
  67.     function DoSetup (blankRgn: rgnHandle; message: integer; params: GMParamBlockPtr): OSErr;
  68.     begin
  69.  
  70. {This is called when the used clicks on a button in the Control Panel.}
  71.  
  72.         DoSetup := noErr;
  73.  
  74.     end;
  75.  
  76. end.