home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / thx / demos / skyscrap / build / lives.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-13  |  440 b   |  28 lines

  1. #include "lives.h"
  2. #include "gfx.h"
  3.  
  4. void Lives::initialize()
  5. {
  6.   load_gfxlib( "ss.gfx" );
  7. }
  8.  
  9. void Lives::draw(void)
  10. {
  11.   static boolean init=FALSE;
  12.   static int width;
  13.   if ( !init )
  14.   {
  15.     width=get_image_width( LIFE );
  16.     int len=(width*lives)+((lives-1)*3);
  17.     x=(320/2)-(len/2), y=3;
  18.     init=TRUE;
  19.   }
  20.   int tx=x;
  21.   for ( int i=0; i<lives; i++ )
  22.   {
  23.     show_image( tx, y, LIFE );
  24.     tx+=width+3;
  25.   }
  26. }
  27.  
  28.