home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / Effect library / Demo ƒ / Demo code ƒ / demo crash.c next >
Encoding:
C/C++ Source or Header  |  1994-01-12  |  2.0 KB  |  67 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        demo crash.c
  4.  
  5. Purpose:    This module handles crashing your machine with grace and
  6.             style.
  7.  
  8.  
  9. MSG Demo -- graphic effects demonstration program
  10. Copyright (C) 1992-4 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "demo crash.h"
  30. #include "demo.h"
  31. #include "msg sounds.h"
  32. #include "msg environment.h"
  33. #include "msg main.h"
  34.  
  35. void RestoreScreen(int oldMenuHeight)
  36. {
  37.     TextFont(0);
  38.     TextSize(0);
  39.     TextMode(srcOr);
  40.     FlushEvents(mDownMask+mUpMask+keyDownMask+keyUpMask+autoKeyMask, 0L);
  41.     MBarHeight=oldMenuHeight;
  42.     DrawMenuBar();
  43.     PaintOne(0L,GrayRgn);
  44.     PaintBehind(WindowList,GrayRgn);
  45.     ShowCursor();
  46.     ObscureCursor();
  47. }
  48.  
  49. void CrashAndBurn(int whichSystemError)
  50. {
  51.     int                oldMenuHeight;
  52.     int                whichWipe;
  53.     
  54.     DoSound(sound_crash, FALSE);
  55.     
  56.     ShutDownEnvironment();        /* If you have to crash a computer, */
  57.                                 /* it costs nothing to be polite. */
  58.     SysError(whichSystemError);
  59.     
  60.     /* in case the user manages to continue, we’ll do neat stuff here */
  61.     whichWipe=1+(TickCount()&0x7fffffff)%32;
  62.     DoFullScreenFade(whichWipe, FALSE);
  63.     
  64.     gDone=TRUE;                    /* we can’t actually continue with the program, */
  65.                                 /* since, after all, the computer thinks we’ve crashed */
  66. }
  67.