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

  1. // ----------- scenery.h
  2.  
  3. #ifndef SCENERY_H
  4. #define SCENERY_H
  5.  
  6. #include "viddir.h"
  7.  
  8. struct Mice  {
  9.   short int x1, y1, x2, y2; // screen rectangle
  10.   char *cursor;             // cursor hotspot(x,y) mask and map
  11.   callback func;            // function to call if left click 
  12. };
  13.  
  14. #define DECLARE_MOUSECURSORS      \
  15.   static Mice MouseCursorTable[]; \
  16.   virtual Mice *GetMouseCursors() \
  17.     { return MouseCursorTable; }
  18.  
  19. #define CURSORLIST(scene)      \
  20.   Mice scene::MouseCursorTable[] = {
  21.  
  22. #define MOUSE_CURSOR(x1,y1,x2,y2,crs,fn) \
  23.     {x1,y1,x2,y2,crs,(callback)fn},
  24.  
  25. #define ENDCURSORLIST  \
  26.   { -1, -1, -1, -1 }   \
  27. };
  28.  
  29. extern char UPCURSOR[];
  30. extern char DNCURSOR[];
  31. extern char RTCURSOR[];
  32. extern char LFCURSOR[];
  33. extern char CNCURSOR[];
  34. extern char ULCURSOR[];
  35. extern char URCURSOR[];
  36. extern char LLCURSOR[];
  37. extern char LRCURSOR[];
  38. extern char DEFAULT[];
  39.  
  40. #define UPPERLEFTARROWCURSOR  ULCURSOR
  41. #define UPARROWCURSOR         UPCURSOR
  42. #define UPPERRIGHTARROWCURSOR URCURSOR
  43. #define LEFTARROWCURSOR       LFCURSOR
  44. #define CENTERCURSOR          CNCURSOR
  45. #define RIGHTARROWCURSOR      RTCURSOR
  46. #define LOWERLEFTARROWCURSOR  LLCURSOR
  47. #define DOWNARROWCURSOR       DNCURSOR
  48. #define LOWERRIGHTARROWCURSOR LRCURSOR
  49. #define DEFAULTCURSOR         DEFAULT
  50.  
  51. const short int ClearEveryTime = -1;
  52. const short int NoTransition = 0;
  53.  
  54. class SceneryDirector : public VideoDirector  {
  55.   short int transition;
  56.   void show_mousecursor(char *cursor);
  57.   void mousemoved(int x, int y, int);
  58.   void mouseclicked(int x, int y);
  59. protected:
  60.   char *scenery;
  61.   Mice *mousecursors;
  62.   DECLARE_CUELIST
  63.   virtual void display();
  64.   virtual void stop_director()
  65.     { quit(); }
  66.   virtual void on_escape()
  67.     { stop_director(); }
  68.     virtual void on_space()
  69.     { stop_director(); }
  70.     virtual void on_enter()
  71.     { stop_director(); }
  72.   virtual const Type_info& get_next_director();
  73.   virtual void initialize();
  74.   virtual Mice *GetMouseCursors()
  75.     { return 0; }
  76.   virtual void refresh_display();
  77.   virtual void display_original_scenery();
  78. public:
  79.   SceneryDirector(char *pcxfile = 0,
  80.                      short int trans = ClearEveryTime);
  81.   virtual ~SceneryDirector()
  82.     { }
  83. };
  84.  
  85. #endif
  86.  
  87.