home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Games / xinvaders / score.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-03  |  1.2 KB  |  49 lines

  1. /* 
  2. Copyright notice:
  3.  
  4. This is mine.  I'm only letting you use it.  Period.  Feel free to rip off
  5. any of the code you see fit, but have the courtesy to give me credit.
  6. Otherwise great hairy beasties will rip your eyes out and eat your flesh
  7. when you least expect it.
  8.  
  9. Jonny Goldman <jonathan@think.com>
  10.  
  11. Wed May  8 1991
  12. */
  13.  
  14. /* score.c -- Print the score. */
  15.  
  16. #include "vaders.h"
  17.  
  18. #define SCORELABEL    10
  19. #define SCOREPOS    (SCORELABEL+15)
  20. #define HILABEL        (SCOREPOS+20)
  21. #define HIPOS        (HILABEL+15)
  22.  
  23. PaintScore()
  24. {
  25.   char scorestring[8];
  26.   XDrawImageString(dpy, labelwindow, scoregc, 0, SCORELABEL, "Score", 5);
  27.   sprintf(scorestring, "%6d ", score);
  28.   XDrawImageString(dpy, labelwindow, scoregc, 0, SCOREPOS, scorestring, 7);
  29.   if (nextbonus && score >= nextbonus) {
  30.     basesleft++;
  31.     ShowBase(basesleft-1, basegc);
  32.     bases = basesleft;
  33.     nextbonus = 0;
  34.   }
  35.   if (score > hiscore)
  36.     hiscore = score;
  37.     sprintf(scorestring, "%6d ", hiscore);
  38.     XDrawImageString(dpy, labelwindow, scoregc, 0, HILABEL, " High", 5);
  39.     XDrawImageString(dpy, labelwindow, scoregc, 0, HIPOS, scorestring, 7);
  40. }
  41.  
  42. InitScore()
  43. {
  44.     score = 0;
  45.     if (hiscore == 0) hiscore = -1;
  46.     basesleft = 3;
  47.     nextbonus = 1500;
  48. }
  49.