home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / thx / include / player.h < prev    next >
C/C++ Source or Header  |  1995-05-08  |  2KB  |  65 lines

  1. // -------- player.h
  2.  
  3. #ifndef PLAYER_H
  4. #define PLAYER_H
  5.  
  6. #include "perform.h"
  7.  
  8. class SceneDirector;
  9.  
  10. class Player : public Performer  {
  11.   char *gfxlib;         // name of .gfx file with Player images
  12.   char *sfxlib;         // name of .sfx file with Player sounds
  13.   short int x, y;       // current screen location
  14.   short int px, py;     // previous screen location
  15.   short int h, w;       // current image size
  16.   short int ph, pw;     // previous image size
  17.   short int imageno;    // current image
  18.   short int is_visible; // true if Player is being displayed
  19.   short int ticker;
  20.   short int interval;
  21.   short int clipped;    // true if image is to be clipped
  22.   short int cx1, cy1, cx2, cy2;  // clip coordinates
  23.   short int in_update_position;
  24.   short int posted_x, posted_y;  // posted screen location
  25.   short int posted_imageno;      // posted image
  26.   void displayframe();
  27.   friend class SceneDirector;
  28. protected:
  29.   SceneDirector *director;
  30.   virtual void initialize();
  31. public:
  32.   Player(char *gl = 0, char *sl = 0, int intv = 1);
  33.   virtual ~Player() { }
  34.   void set_imageno(short int in);
  35.   short int get_imageno()
  36.     { return imageno; }
  37.   short int getx() const
  38.     { return x; }
  39.   short int gety() const
  40.     { return y; }
  41.   void setx(short int nx);
  42.   void sety(short int ny);
  43.   void setxy(short int nx, short int ny);
  44.   short int getheight() const
  45.     { return h; }
  46.   short int getwidth() const
  47.     { return w; }
  48.   void stillframe(short int im, short int wait);
  49.   virtual void appear()
  50.     { is_visible = 1; }
  51.   virtual void disappear();
  52.   int isvisible()
  53.     { return is_visible; }
  54.   virtual void update_position() { }
  55.   void clip(int x1, int y1, int x2, int y2);
  56.   void unclip()
  57.     { clipped = 0; }
  58.   int isclipped()
  59.     { return clipped; }
  60.   void setinterval(short int inv)
  61.     { interval = inv; ticker = 0; }
  62. };
  63.  
  64. #endif
  65.