00001 #ifndef __OBJECTFACE_H
00002 #define __OBJECTFACE_H
00003 
00004 class FacingInterface
00005 {
00006 protected:
00007   Object* obj;
00008   int dir;
00009   bool allow_setting; 
00010   void SetDir( int new_dir ); 
00011 public:
00012   FacingInterface( Object* _obj, int _dir, bool _allow_setting ):
00013     obj( _obj ),
00014     dir( _dir ),
00015     allow_setting( _allow_setting ) {}
00016   virtual ~FacingInterface() {}
00017   virtual void Event( int evt ) {} 
00018   int Direction() { return dir; }
00019   void SetDirection( int new_dir ); 
00020 };
00021 
00022 class FacePassive: public FacingInterface
00023 {
00024 public:
00025   FacePassive( Object* _obj, int _dir ):
00026     FacingInterface( _obj, _dir, true ) {}
00027   virtual ~FacePassive() {}
00028   virtual void Event( int evt ) {}
00029   void SetDirection( int new_dir ) { dir = new_dir; }
00030 };
00031 
00032 
00033 
00034 class FaceBouncing: public FacingInterface
00035 {
00036 public:
00037   FaceBouncing( Object* _obj, int _dir ):
00038     FacingInterface( _obj, _dir, false ) {}
00039   virtual ~FaceBouncing() {}
00040   virtual void Event( int evt );
00041 };
00042 
00043 
00044 
00045 
00046 class FaceFrog: public FacingInterface
00047 {
00048 public:
00049   FaceFrog( Object* _obj, int _dir ):
00050     FacingInterface( _obj, _dir, false ) {}
00051   virtual ~FaceFrog() {}
00052   virtual void Event( int evt );
00053 };
00054 
00055 
00056 
00057 class FacePlayer: public FacingInterface
00058 {
00059 public:
00060   FacePlayer( Object* _obj, int _dir ):
00061     FacingInterface( _obj, _dir, false ) {}
00062   virtual ~FacePlayer() {}
00063   virtual void Event( int evt );
00064 };
00065 
00066 
00067 class FaceRotate: public FacingInterface
00068 {
00069 private:
00070   bool cwise;            
00071   int duration;          
00072   int count;             
00073 public:
00074   FaceRotate( Object* _obj, int _dir, bool _cwise, int _ms ):
00075     FacingInterface( _obj, _dir, false ),
00076     cwise( _cwise ),
00077     duration( _ms ), count( _ms ) {}
00078   virtual ~FaceRotate() {}  
00079   virtual void Event( int evt ); 
00080 };
00081 
00082 #endif // __OBJECTFACE_H