home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / thx / demos / mfighter / build / ndisplay.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-18  |  744 b   |  41 lines

  1. #include <fastgraf.h>
  2. #include <string.h>
  3. #include "ndisplay.h"
  4. #include "viddir.h"
  5. #include "standard.h"
  6.  
  7. NumericDisplay::NumericDisplay(Director* d,char* lib,int i,
  8.                                 int m,int xx,int yy) : Performer(d)
  9.   {
  10.   value=i;
  11.   x=xx;
  12.   y=yy;
  13.   max=m;
  14.   strcpy(gfxlib,lib);
  15.   }
  16.  
  17. void NumericDisplay::initialize()
  18.   {
  19.   init_flag=FALSE;
  20.   load_gfxfont(gfxlib);
  21.   }
  22.  
  23. void NumericDisplay::set(int v)
  24.   {
  25.   value=v;
  26.   }
  27.  
  28. void NumericDisplay::update()
  29.   {
  30.   if (!init_flag)
  31.     {
  32.     w=get_char_width('0')*max+5;
  33.     h=get_char_height('0');
  34.     init_flag=TRUE;
  35.     }
  36.   VideoDirector::restore_patch(x,y,x+w,y+h);
  37.   show_number(x,y,value);
  38.   VideoDirector::flush_patch(x,y,x+w,y+h);
  39.   }
  40.  
  41.