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

SCA_MouseSensor.h

Go to the documentation of this file.
00001 
00006 
00007 #ifndef __KX_MOUSESENSOR
00008 #define __KX_MOUSESENSOR
00009 
00010 #include "SCA_ISensor.h"
00011 #include "BoolValue.h"
00012 #include "SCA_IInputDevice.h"
00013 
00014 class SCA_MouseSensor : public SCA_ISensor
00015 {
00016         Py_Header;
00017         class SCA_MouseManager* m_pMouseMgr;
00018         
00022         short int m_mousemode;
00027         bool m_triggermode;
00031         int m_val;
00032 
00033         SCA_IInputDevice::KX_EnumInputs m_hotkey;
00034         
00038         unsigned short m_x;
00039 
00043         unsigned short m_y;
00044         
00045  public:
00046         enum KX_MOUSESENSORMODE {
00047                 KX_MOUSESENSORMODE_NODEF = 0,
00048                 KX_MOUSESENSORMODE_LEFTBUTTON,
00049                 KX_MOUSESENSORMODE_MIDDLEBUTTON,
00050                 KX_MOUSESENSORMODE_RIGHTBUTTON,
00051                 KX_MOUSESENSORMODE_POSITION,
00052                 KX_MOUSESENSORMODE_POSITIONX,
00053                 KX_MOUSESENSORMODE_POSITIONY,
00054                 KX_MOUSESENSORMODE_MOVEMENT,
00055                 KX_MOUSESENSORMODE_MAX
00056         };
00057 
00058         bool isValid(KX_MOUSESENSORMODE);
00059         
00060         SCA_MouseSensor(class SCA_MouseManager* keybdmgr,
00061                                         int startx,int starty,
00062                                    short int mousemode,
00063                                    SCA_IObject* gameobj,
00064                                    PyTypeObject* T=&Type );
00065 
00066         virtual ~SCA_MouseSensor();
00067         virtual CValue* GetReplica() {
00068                 CValue* replica = new SCA_MouseSensor(*this);
00069                 // this will copy properties and so on...
00070                 CValue::AddDataToReplica(replica);
00071                 return replica;
00072         };
00073 
00074 
00075 
00076         virtual bool Evaluate(CValue* event);
00077 
00078         virtual bool IsPositiveTrigger() {
00079                 bool result = (m_val != 0);
00080                 if (m_invert) result = !result;
00081                 return result;
00082         }
00083 
00084         short int GetModeKey() { return m_mousemode;}
00085         SCA_IInputDevice::KX_EnumInputs GetHotKey() { return m_hotkey;}
00086         void setX(unsigned short x);
00087         void setY(unsigned short y);
00088         
00089         /* --------------------------------------------------------------------- */
00090         /* Python interface ---------------------------------------------------- */
00091         /* --------------------------------------------------------------------- */
00092 
00093         virtual PyObject*  _getattr(char *attr);
00094 
00095         /* read x-coordinate */
00096         KX_PYMETHOD_DOC(SCA_MouseSensor,GetXPosition);
00097         /* read y-coordinate */
00098         KX_PYMETHOD_DOC(SCA_MouseSensor,GetYPosition);
00099 
00100 };
00101 
00102 #endif //__KX_MOUSESENSOR

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