home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / misc / dr.str / Source / Ball.c next >
Encoding:
C/C++ Source or Header  |  1992-05-14  |  894 b   |  54 lines  |  [TEXT/KAHL]

  1. #include "StrangeGlove.h"
  2.  
  3. extern WindowPtr    gBallWindow;
  4. extern GrafPort        ballOffScr;
  5. extern Boolean        gBall;
  6.  
  7. /***** DrawBall *****/
  8. DrawBall(int x, int y, int z)
  9. {
  10.     GrafPtr oldPort;
  11.     Rect    ballRect;
  12.     int        size;
  13.     
  14.     GetPort(&oldPort);
  15.     SetPort(&ballOffScr);                        /* Set port to off-screen port */
  16.  
  17.     EraseRect(&(gBallWindow->portRect));
  18.     
  19.     size = z / 5;
  20.     ballRect.top = y - size;
  21.     ballRect.left = x - size;
  22.     ballRect.bottom = y + size;
  23.     ballRect.right = x + size;
  24.     PaintOval(&ballRect);
  25.     
  26.     GetWind(gBallWindow, ballOffScr);            /* Copy stuff to window */
  27.  
  28.     SetPort(oldPort);
  29. }
  30.  
  31.  
  32. /***** StartBall *****/
  33. StartBall()
  34. {
  35.     gBall = TRUE;
  36.  
  37.     SetPort(gBallWindow);
  38.     ShowWindow(gBallWindow);
  39.     SelectWindow(gBallWindow);
  40.     AdjustWindowMenu();
  41.  
  42.     StartContinuous();                    /* Put glove into continuous mode */
  43. }
  44.  
  45.  
  46. /***** StopTerm *****/
  47. StopBall()
  48. {
  49.     gBall = FALSE;
  50.     HideWindow(gBallWindow);
  51.     AdjustWindowMenu();
  52. }
  53.  
  54.