home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / thx / source / theatrix / perform.cpp < prev    next >
C/C++ Source or Header  |  1995-04-18  |  2KB  |  84 lines

  1. #include <dir.h>
  2. #include <fstream.h>
  3. #include <iomanip.h>
  4. #include <io.h>
  5. #include <values.h>    // MAXINT
  6. #include <string.h>
  7. #include <stdlib.h>
  8. #include "standard.h"
  9. #include "perform.h"
  10. #include "xms.h"
  11.  
  12. GraphicsMedia Performer::gfxlib;
  13.  
  14. Performer::Performer(Director* d) : VocalHand(d)
  15.   {
  16.   curlib=-1;
  17.   curfont=-1;
  18.   }
  19.  
  20. Performer::~Performer()
  21.   {
  22.   }
  23.  
  24. void Performer::load_gfxlib(char* fname)
  25.   {
  26.   gfxlib.load_library(fname);
  27.   set_gfxlib(fname);
  28.   }
  29.  
  30. void Performer::set_gfxlib(char* fname)
  31.   {
  32.   curlib=gfxlib.library_number(fname);
  33.   }
  34.  
  35. void Performer::load_gfxfont(char* fname)
  36.   {
  37.   gfxlib.load_library(fname);
  38.   set_gfxfont(fname);
  39.   }
  40.  
  41. void Performer::set_gfxfont(char* fname)
  42.   {
  43.   curfont=gfxlib.library_number(fname);
  44.   }
  45.  
  46. void Performer::thx_show_print(int x,int y,char* str)
  47.   {
  48.  
  49.   int index;
  50.   char* p=str;
  51.   while (*p!='\0')
  52.     {
  53.     if (*p==32)
  54.       x+=5;
  55.     else
  56.       {
  57.       if (*p<'A')          index=*p-48+26;
  58.       else if (*p>='a')    index=*p-97+36;
  59.       else                index=*p-65;
  60.       MediaClip& mc = gfxlib.getclip(curfont,index);
  61.       fg_move(x,y+mc.h);
  62.       fg_drwimage(mc.buf, mc.w, mc.h);
  63.       x += mc.w+1;
  64.       }
  65.     p++;
  66.     }
  67.   }
  68.  
  69. void Performer::thx_show_number(int x,int y,int num)
  70.   {
  71.   char str[40];
  72.   itoa(num,str,10);
  73.   char* p=str;
  74.   while (*p!='\0')
  75.     {
  76.     MediaClip& mc = gfxlib.getclip(curfont,*p-48+26);
  77.     fg_move(x,y+mc.h);
  78.     fg_drwimage(mc.buf, mc.w, mc.h);
  79.     x += mc.w + 1;
  80.     p++;
  81.     }
  82.   }
  83.  
  84.