2 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version. The Blender
8 * Foundation also sells licenses for use in proprietary software under
9 * the Blender License. See http://www.blender.org/BL/ for information
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
22 * All rights reserved.
24 * The Original Code is: all of this file.
26 * Contributor(s): none yet.
28 * ***** END GPL/BL DUAL LICENSE BLOCK *****
32 #ifndef __JOYSENSOR_H_
35 #include "SCA_ISensor.h"
37 class SCA_JoystickSensor :public SCA_ISensor
40 class SCA_JoystickManager* m_pJoystickMgr;
47 * Axis flag to find direction
55 * Flag for a pressed or released button
63 * Flag to find direction 1-12
67 * The threshold value the axis acts opon
71 * Is an event triggered ?
75 * The mode to determine axis,button or hat
79 enum KX_JOYSENSORMODE {
80 KX_JOYSENSORMODE_NODEF = 0,
81 KX_JOYSENSORMODE_AXIS,
82 KX_JOYSENSORMODE_BUTTON,
86 bool isValid(KX_JOYSENSORMODE);
89 SCA_JoystickSensor(class SCA_JoystickManager* eventmgr,
92 int axis, int axisf,int prec,
93 int button, int buttonf,
95 PyTypeObject* T=&Type );
96 virtual ~SCA_JoystickSensor();
97 virtual CValue* GetReplica();
99 virtual bool Evaluate(CValue* event);
100 virtual bool IsPositiveTrigger();
102 /* --------------------------------------------------------------------- */
103 /* Python interface ---------------------------------------------------- */
104 /* --------------------------------------------------------------------- */
106 virtual PyObject* _getattr(const STR_String& attr);
109 KX_PYMETHOD_DOC(SCA_JoystickSensor,GetAxis);
110 KX_PYMETHOD_DOC(SCA_JoystickSensor,SetAxis);
111 KX_PYMETHOD_DOC(SCA_JoystickSensor,GetRealAxis);
112 KX_PYMETHOD_DOC(SCA_JoystickSensor,GetThreshold);
113 KX_PYMETHOD_DOC(SCA_JoystickSensor,SetThreshold);
115 KX_PYMETHOD_DOC(SCA_JoystickSensor,GetButton);
116 KX_PYMETHOD_DOC(SCA_JoystickSensor,SetButton);
118 KX_PYMETHOD_DOC(SCA_JoystickSensor,GetHat);
119 KX_PYMETHOD_DOC(SCA_JoystickSensor,SetHat);
121 KX_PYMETHOD_DOC(SCA_JoystickSensor,NumberOfAxes);
122 KX_PYMETHOD_DOC(SCA_JoystickSensor,NumberOfButtons);
123 KX_PYMETHOD_DOC(SCA_JoystickSensor,NumberOfHats);