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

SCA_KeyboardSensor.h

Go to the documentation of this file.
00001 
00007 
00008 #ifndef __KX_KEYBOARDSENSOR
00009 #define __KX_KEYBOARDSENSOR
00010 
00011 #include "SCA_ISensor.h"
00012 #include "BoolValue.h"
00013 #include "SCA_ISystem.h"
00014 #include <list>
00015 
00016 class SCA_KeyboardSensor : public SCA_ISensor
00017 {
00018         Py_Header;
00019         class SCA_KeyboardManager*      m_pKeyboardMgr;
00021         int                                                     m_hotkey;
00022         short int                                       m_qual,m_qual2;
00023         short int                                       m_val;
00024         bool                                            m_bAllKeys;
00025 
00026 
00027         
00028 public:
00029         SCA_KeyboardSensor(class SCA_KeyboardManager* keybdmgr,short int hotkey,short int qual,short int qual2,bool bAllKeys,SCA_IObject* gameobj,PyTypeObject* T=&Type );
00030         virtual ~SCA_KeyboardSensor() {};
00031         virtual CValue* GetReplica() {
00032                 CValue* replica = new SCA_KeyboardSensor(*this);
00033                 // this will copy properties and so on...
00034                 CValue::AddDataToReplica(replica);
00035                 return replica;
00036         };
00037 
00038 
00039         short int GetHotkey() { return m_hotkey;}
00040         virtual bool Evaluate(CValue* event);
00041         
00042         virtual bool IsPositiveTrigger() { 
00043                 bool result = (m_val != 0);
00044                 if (m_invert) result = !result;
00045                 return result;
00046         }
00047         bool    TriggerOnAllKeys()              { 
00048                 return m_bAllKeys;
00049         };
00050 
00051         /* --------------------------------------------------------------------- */
00052         /* Python interface ---------------------------------------------------- */
00053         /* --------------------------------------------------------------------- */
00054 
00055         virtual PyObject*  _getattr(char *attr);
00056 
00057 
00058         PyObject* PySetAllMode(PyObject* self, 
00059                                PyObject* args, 
00060                                PyObject* kwds)

00061           {
00062 
00063                 bool allkeys;
00064                 if (!PyArg_ParseTuple(args, "i", &allkeys))
00065                 {
00066                   return NULL;
00067                 }
00068                 m_bAllKeys = allkeys;
00069             Py_Return
00070           }
00071         static PyObject* sPySetAllMode(PyObject* self, 
00072                                        PyObject* args, 
00073                                        PyObject* kwds)

00074           {
00075 //          printf("sPyIsPositive\n");
00076             return ((SCA_KeyboardSensor*) self)->PyIsPositive(self, args, kwds);
00077           }
00078         
00080         KX_PYMETHOD_DOC(SCA_KeyboardSensor,GetKey);
00082         KX_PYMETHOD_DOC(SCA_KeyboardSensor,SetKey);
00084         KX_PYMETHOD_DOC(SCA_KeyboardSensor,GetHold1);
00086         KX_PYMETHOD_DOC(SCA_KeyboardSensor,SetHold1);
00088         KX_PYMETHOD_DOC(SCA_KeyboardSensor,GetHold2);
00090         KX_PYMETHOD_DOC(SCA_KeyboardSensor,SetHold2);
00092         //KX_PYMETHOD_DOC(SCA_KeyboardSensor,GetUseAllKeys);
00094         //KX_PYMETHOD_DOC(SCA_KeyboardSensor,SetUseAllKeys);
00096         KX_PYMETHOD_DOC(SCA_KeyboardSensor,GetPressedKeys); 
00098         //KX_PYMETHOD_DOC(SCA_KeyboardSensor,GetKeyEvents); 
00099 };
00100 
00101 #endif //__KX_KEYBOARDSENSOR

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