00001
00006
00007 #ifndef __KX_IPOACTUATOR
00008 #define __KX_IPOACTUATOR
00009
00010 #include "SCA_IActuator.h"
00011
00012 class KX_IpoActuator : public SCA_IActuator
00013 {
00014 Py_Header;
00015
00016 bool m_bNegativeEvent;
00017
00018 float m_starttime,m_endtime;
00019 float m_localtime;
00020 float m_direction;
00021 CCString m_propname;
00022 bool m_useForce;
00023
00024 public:
00025 enum IpoActType
00026 {
00027 KX_ACT_IPO_NODEF = 0,
00028 KX_ACT_IPO_PLAY,
00029 KX_ACT_IPO_PINGPONG,
00030 KX_ACT_IPO_FLIPPER,
00031 KX_ACT_IPO_LOOPSTOP,
00032 KX_ACT_IPO_LOOPEND,
00033 KX_ACT_IPO_KEY2KEY,
00034 KX_ACT_IPO_FROM_PROP,
00035 KX_ACT_IPO_MAX
00036 };
00037
00038 static CCString S_KX_ACT_IPO_PLAY_STRING;
00039 static CCString S_KX_ACT_IPO_PINGPONG_STRING;
00040 static CCString S_KX_ACT_IPO_FLIPPER_STRING;
00041 static CCString S_KX_ACT_IPO_LOOPSTOP_STRING;
00042 static CCString S_KX_ACT_IPO_LOOPEND_STRING;
00043 static CCString S_KX_ACT_IPO_KEY2KEY_STRING;
00044 static CCString S_KX_ACT_IPO_FROM_PROP_STRING;
00045
00046 IpoActType string2mode(char* modename);
00047
00048 IpoActType m_type;
00049
00050 KX_IpoActuator(SCA_IObject* gameobj,const CCString& propname,float starttime,float endtime,int acttype,PyTypeObject* T=&Type)
00051 : SCA_IActuator(gameobj,T),
00052 m_starttime (starttime),
00053 m_endtime(endtime) ,
00054 m_localtime(starttime),
00055 m_type((IpoActType)acttype) ,
00056 m_direction(1),
00057 m_bNegativeEvent(false),
00058 m_propname(propname)
00059 {};
00060 virtual ~KX_IpoActuator() {};
00061
00062 virtual CValue* GetReplica() {
00063 KX_IpoActuator* replica = new KX_IpoActuator(*this);
00064 replica->ProcessReplica();
00065
00066 CValue::AddDataToReplica(replica);
00067 return replica;
00068 };
00069
00070 void SetStart(float starttime) { m_starttime=starttime;}
00071 void SetEnd(float endtime) { m_endtime=endtime;}
00072 virtual bool Update(double curtime,double deltatime);
00073
00074
00075
00076
00077
00078 virtual PyObject* _getattr(char *attr);
00079
00080 KX_PYMETHOD(KX_IpoActuator,Set);
00081 KX_PYMETHOD(KX_IpoActuator,SetProperty);
00082 KX_PYMETHOD(KX_IpoActuator,SetKey2Key);
00083 KX_PYMETHOD(KX_IpoActuator,SetStart);
00084 KX_PYMETHOD(KX_IpoActuator,GetStart);
00085 KX_PYMETHOD(KX_IpoActuator,SetEnd);
00086 KX_PYMETHOD(KX_IpoActuator,GetEnd);
00087 KX_PYMETHOD(KX_IpoActuator,SetUseForce);
00088 KX_PYMETHOD(KX_IpoActuator,GetUseForce);
00089 KX_PYMETHOD(KX_IpoActuator,SetType);
00090 KX_PYMETHOD(KX_IpoActuator,GetType);
00091
00092 };
00093
00094 #endif //__KX_IPOACTUATOR