Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

KX_TouchSensor.h

Go to the documentation of this file.
00001 
00006 
00007 #ifndef __KX_TOUCHSENSOR
00008 #define __KX_TOUCHSENSOR
00009 
00010 #include "solid.h"
00011 #include "SCA_ISensor.h"
00012 #include "ListValue.h"
00013 
00014 #include "SM_ClientObjectInfo.h"
00015 
00016 class KX_TouchSensor : public SCA_ISensor
00017 {
00018 protected:
00019         Py_Header;
00020         
00021         CCString                                m_touchedpropname;      
00022         bool                                    m_bFindMaterial;
00023         class SCA_EventManager* m_eventmgr;
00024         class SM_Object*                m_sumoObj;
00025 
00026         SM_ClientObjectInfo             m_client_info;
00027         bool                                    m_bCollision;
00028         bool                                    m_bTriggered;
00029         bool                                    m_bLastTriggered;
00030         SCA_IObject*                m_hitObject;
00031         class CListValue*               m_colliders;
00032         
00033 public:
00034         KX_TouchSensor(class SCA_EventManager* eventmgr,
00035                 class KX_GameObject* gameobj,
00036                 class SM_Object* sumoObj,
00037                 bool fFindMaterial,
00038                 const CCString& touchedpropname,
00039                 PyTypeObject* T=&Type) ;
00040         virtual ~KX_TouchSensor();
00041 
00042         virtual CValue* GetReplica() {
00043                 KX_TouchSensor* replica = new KX_TouchSensor(*this);
00044                 replica->m_colliders = new CListValue();
00045                 replica->m_bCollision = false;
00046                 replica->m_bTriggered= false;
00047                 replica->m_hitObject = NULL;
00048                 replica->m_bLastTriggered = false;
00049                 // this will copy properties and so on...
00050                 CValue::AddDataToReplica(replica);
00051                 return replica;
00052         };
00053         virtual void SynchronizeTransform();
00054         virtual bool Evaluate(CValue* event);
00055         virtual void ReParent(SCA_IObject* parent);
00056         
00057         static void collisionResponse(void *client_data, 
00058                                                                   void *object1,
00059                                                                   void *object2,
00060                                                                   const DT_CollData *coll_data) {
00061                 class KX_TouchSensor* sensor = (class KX_TouchSensor*) client_data;
00062                 sensor->HandleCollision(object1,object2,coll_data);
00063         }
00064         
00065 
00066         
00067         void RegisterSumo(class SCA_EventManager *eventmgr,
00068                                           DT_RespTableHandle resptable);
00069 
00070         virtual bool IsPositiveTrigger() {
00071                 bool result = m_bTriggered;
00072                 if (m_invert) result = !result;
00073                 return result;
00074         }
00075 
00076         SM_Object*      GetSumoObject() { return m_sumoObj; };
00077         
00078         void EndFrame();
00079 
00080         virtual void HandleCollision(void* obj1,void* obj2,
00081                                                  const DT_CollData * coll_data); 
00082         // todo: put some info for collision maybe
00083 
00084         /* --------------------------------------------------------------------- */
00085         /* Python interface ---------------------------------------------------- */
00086         /* --------------------------------------------------------------------- */
00087         
00088         virtual PyObject*  _getattr(char *attr);
00089 
00090         /* 1. setProperty */
00091         KX_PYMETHOD_DOC(KX_TouchSensor,SetProperty);
00092         /* 2. getProperty */
00093         KX_PYMETHOD_DOC(KX_TouchSensor,GetProperty);
00094         /* 3. getHitObject */
00095         KX_PYMETHOD_DOC(KX_TouchSensor,GetHitObject);
00096         /* 4. getHitObject */
00097         KX_PYMETHOD_DOC(KX_TouchSensor,GetHitObjectList);
00098         /* 5. getTouchMaterial */
00099         KX_PYMETHOD_DOC(KX_TouchSensor,GetTouchMaterial);
00100         /* 6. setTouchMaterial */
00101         KX_PYMETHOD_DOC(KX_TouchSensor,SetTouchMaterial);
00102         
00103 };
00104 
00105 #endif //__KX_TOUCHSENSOR
00106 
00107 
00108 

Generated at Thu Feb 1 13:03:07 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000