home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / clock.zip / CLKHRH.C < prev    next >
Text File  |  1987-10-25  |  2KB  |  52 lines

  1. /***************************************************** CLKHRH.C
  2.  * NAME:    CLKHRH
  3.  *
  4.  * FUNCTION:    Computes hour hand
  5.  *
  6.  * EXAMPLE:    CLKHRH();
  7.  *
  8.  * INPUTS:    determined from global variables
  9.  *        acthr, hrwth, lasthr, thishr
  10.  *
  11.  * OUTPUT:    placed into global variables
  12.  *        acbhr, acdhr
  13.  *
  14.  **************************************************************
  15.  * 11/22/86 -RBM- original implementation
  16.  * 10/25/87 -RBM- fixed bug imaging 12:00 hand
  17.  **************************************************************/
  18. #define XTRNALGLOBALS 1        /* globals externally defined    */
  19. #include "E:CLKGBL.H"        /* setup global storage */
  20.  
  21. /**************************************************************
  22.  * BEGIN ROUTINE
  23.  **************************************************************/
  24.  
  25. clkhrh()
  26. {
  27. int    i;            /* temporary counter            */
  28. int    blkhnd;            /* blanking hand (area to blank out)    */
  29. struct    ACTIMAGE *imgptr;    /* pointer to hand image structure    */
  30.  
  31. if (lastmn != thismn)        /* active only when min changes        */
  32.     {
  33.     change = 1;        /* show hands changed            */
  34.     /*--- determine which hand to use ---*/
  35.     if (thishr == 12) i = 0;
  36.     else i = thishr;
  37.     acthr = ((int)(i*5)) + ((int)(thismn/10));
  38.     if (acthr >= 60) acthr = 59;
  39.  
  40.     /*--- determine what to blank --------*/
  41.     blkhnd = acthr - 1;
  42.     if (blkhnd < 0) blkhnd = 59;
  43.  
  44.     /*--- build hour hand images ---------*/
  45.     imgptr = &acbhr[0];
  46.     clkimgh (imgptr, blkhnd);    /* image blanking    */
  47.     imgptr = &acdhr[0];
  48.     clkimgh (imgptr, acthr);    /* image drawing    */
  49.     };
  50.  
  51. }                /***** end of routine ******/
  52.