Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r--source/gameengine/GameLogic/CMakeLists.txt1
-rw-r--r--source/gameengine/GameLogic/Joystick/Makefile2
-rw-r--r--source/gameengine/GameLogic/Makefile6
-rw-r--r--source/gameengine/GameLogic/SCA_2DFilterActuator.cpp3
-rw-r--r--source/gameengine/GameLogic/SCA_ANDController.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_ActuatorEventManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_ActuatorSensor.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_AlwaysEventManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_AlwaysSensor.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_BasicEventManager.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_BasicEventManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_DelaySensor.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_EventManager.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_EventManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_ExpressionController.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_ExpressionController.h2
-rw-r--r--source/gameengine/GameLogic/SCA_IActuator.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_IActuator.h2
-rw-r--r--source/gameengine/GameLogic/SCA_IController.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_IInputDevice.h11
-rw-r--r--source/gameengine/GameLogic/SCA_ILogicBrick.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_IObject.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_IScene.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_IScene.h2
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.cpp21
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.h15
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickManager.cpp3
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickSensor.cpp5
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardSensor.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_LogicManager.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_LogicManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_MouseManager.cpp18
-rw-r--r--source/gameengine/GameLogic/SCA_MouseManager.h5
-rw-r--r--source/gameengine/GameLogic/SCA_MouseSensor.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_NANDController.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_NORController.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_ORController.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_PropertyActuator.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_PropertyEventManager.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_PropertyEventManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_PropertySensor.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp74
-rw-r--r--source/gameengine/GameLogic/SCA_PythonKeyboard.cpp104
-rw-r--r--source/gameengine/GameLogic/SCA_PythonKeyboard.h44
-rw-r--r--source/gameengine/GameLogic/SCA_PythonMouse.cpp178
-rw-r--r--source/gameengine/GameLogic/SCA_PythonMouse.h53
-rw-r--r--source/gameengine/GameLogic/SCA_RandomActuator.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_RandomEventManager.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_RandomEventManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_RandomNumberGenerator.h2
-rw-r--r--source/gameengine/GameLogic/SCA_RandomSensor.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_TimeEventManager.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_TimeEventManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_XNORController.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_XORController.cpp4
60 files changed, 481 insertions, 210 deletions
diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt
index 3ffba14ec95..93183dafeee 100644
--- a/source/gameengine/GameLogic/CMakeLists.txt
+++ b/source/gameengine/GameLogic/CMakeLists.txt
@@ -49,4 +49,3 @@ ELSE(WITH_PYTHON)
ENDIF(WITH_PYTHON)
BLENDERLIB(bf_logic "${SRC}" "${INC}")
-#env.BlenderLib ( 'bf_logic', sources, Split(incs), [], libtype=['game','player'], priority=[30, 110] )
diff --git a/source/gameengine/GameLogic/Joystick/Makefile b/source/gameengine/GameLogic/Joystick/Makefile
index 02def1cec62..5ab297824dd 100644
--- a/source/gameengine/GameLogic/Joystick/Makefile
+++ b/source/gameengine/GameLogic/Joystick/Makefile
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
diff --git a/source/gameengine/GameLogic/Makefile b/source/gameengine/GameLogic/Makefile
index a1794a60452..9c8bd73cdc0 100644
--- a/source/gameengine/GameLogic/Makefile
+++ b/source/gameengine/GameLogic/Makefile
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
@@ -38,10 +38,10 @@ include nan_compile.mk
CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-CPPFLAGS += -I../Expressions
+CPPFLAGS += -I../Expressions
CPPFLAGS += -I../SceneGraph
CPPFLAGS += -I../Rasterizer
-CPPFLAGS += -I$(NAN_STRING)/include
+CPPFLAGS += -I$(NAN_STRING)/include
CPPFLAGS += -I$(NAN_MOTO)/include
CPPFLAGS += -I../../blender/makesdna
CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
index 24f919b7364..f6d24af0e67 100644
--- a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
@@ -26,9 +26,6 @@
#include "SCA_IActuator.h"
#include "SCA_2DFilterActuator.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
#include <iostream>
SCA_2DFilterActuator::~SCA_2DFilterActuator()
diff --git a/source/gameengine/GameLogic/SCA_ANDController.cpp b/source/gameengine/GameLogic/SCA_ANDController.cpp
index 134e363708c..53c9be5215e 100644
--- a/source/gameengine/GameLogic/SCA_ANDController.cpp
+++ b/source/gameengine/GameLogic/SCA_ANDController.cpp
@@ -34,10 +34,6 @@
#include "SCA_LogicManager.h"
#include "BoolValue.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp b/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp
index 5b2bdb07892..9a6ed25a203 100644
--- a/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp
@@ -30,10 +30,6 @@
#include "SCA_ActuatorEventManager.h"
#include "SCA_ActuatorSensor.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
SCA_ActuatorEventManager::SCA_ActuatorEventManager(class SCA_LogicManager* logicmgr)
: SCA_EventManager(logicmgr, ACTUATOR_EVENTMGR)
diff --git a/source/gameengine/GameLogic/SCA_ActuatorEventManager.h b/source/gameengine/GameLogic/SCA_ActuatorEventManager.h
index 9adb9fcca39..859cc5023f1 100644
--- a/source/gameengine/GameLogic/SCA_ActuatorEventManager.h
+++ b/source/gameengine/GameLogic/SCA_ActuatorEventManager.h
@@ -47,7 +47,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_ActuatorEventManager"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_ActuatorEventManager"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp b/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
index af5c3e7d364..c77e58d2f3b 100644
--- a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
@@ -34,10 +34,6 @@
#include "SCA_EventManager.h"
#include "SCA_LogicManager.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
SCA_ActuatorSensor::SCA_ActuatorSensor(SCA_EventManager* eventmgr,
SCA_IObject* gameobj,
const STR_String& actname)
diff --git a/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp b/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp
index d1d7ac2095e..7ecd286ea43 100644
--- a/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp
@@ -35,10 +35,6 @@
#include <vector>
#include "SCA_ISensor.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
using namespace std;
SCA_AlwaysEventManager::SCA_AlwaysEventManager(class SCA_LogicManager* logicmgr)
diff --git a/source/gameengine/GameLogic/SCA_AlwaysEventManager.h b/source/gameengine/GameLogic/SCA_AlwaysEventManager.h
index cbbb5debd3c..59429303fc4 100644
--- a/source/gameengine/GameLogic/SCA_AlwaysEventManager.h
+++ b/source/gameengine/GameLogic/SCA_AlwaysEventManager.h
@@ -41,7 +41,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_AlwaysEventManager"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_AlwaysEventManager"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp b/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
index 6198a3ba471..0f3b81a057e 100644
--- a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
@@ -29,10 +29,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#ifdef WIN32
// This warning tells us about truncation of __long__ stl-generated names.
// It can occasionally cause DevStudio to have internal compiler warnings.
diff --git a/source/gameengine/GameLogic/SCA_BasicEventManager.cpp b/source/gameengine/GameLogic/SCA_BasicEventManager.cpp
index f07d3309386..2fdb1a96216 100644
--- a/source/gameengine/GameLogic/SCA_BasicEventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_BasicEventManager.cpp
@@ -35,10 +35,6 @@
#include <vector>
#include "SCA_ISensor.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
using namespace std;
SCA_BasicEventManager::SCA_BasicEventManager(class SCA_LogicManager* logicmgr)
diff --git a/source/gameengine/GameLogic/SCA_BasicEventManager.h b/source/gameengine/GameLogic/SCA_BasicEventManager.h
index a0fae4958c1..db67b180fd8 100644
--- a/source/gameengine/GameLogic/SCA_BasicEventManager.h
+++ b/source/gameengine/GameLogic/SCA_BasicEventManager.h
@@ -48,7 +48,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_BasicEventManager"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_BasicEventManager"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.cpp b/source/gameengine/GameLogic/SCA_DelaySensor.cpp
index 502c2cb6370..701bcb2fc2f 100644
--- a/source/gameengine/GameLogic/SCA_DelaySensor.cpp
+++ b/source/gameengine/GameLogic/SCA_DelaySensor.cpp
@@ -29,10 +29,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#ifdef WIN32
// This warning tells us about truncation of __long__ stl-generated names.
// It can occasionally cause DevStudio to have internal compiler warnings.
diff --git a/source/gameengine/GameLogic/SCA_EventManager.cpp b/source/gameengine/GameLogic/SCA_EventManager.cpp
index c78acd380e0..3a4a06ebfbd 100644
--- a/source/gameengine/GameLogic/SCA_EventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_EventManager.cpp
@@ -30,10 +30,6 @@
#include "SCA_EventManager.h"
#include "SCA_ISensor.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
SCA_EventManager::SCA_EventManager(SCA_LogicManager* logicmgr, EVENT_MANAGER_TYPE mgrtype)
:m_logicmgr(logicmgr),
diff --git a/source/gameengine/GameLogic/SCA_EventManager.h b/source/gameengine/GameLogic/SCA_EventManager.h
index 8f77e7d4905..b01d3641cdb 100644
--- a/source/gameengine/GameLogic/SCA_EventManager.h
+++ b/source/gameengine/GameLogic/SCA_EventManager.h
@@ -82,7 +82,7 @@ protected:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_EventManager"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_EventManager"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_ExpressionController.cpp b/source/gameengine/GameLogic/SCA_ExpressionController.cpp
index 0db36099984..b678648ca58 100644
--- a/source/gameengine/GameLogic/SCA_ExpressionController.cpp
+++ b/source/gameengine/GameLogic/SCA_ExpressionController.cpp
@@ -38,10 +38,6 @@
#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
diff --git a/source/gameengine/GameLogic/SCA_ExpressionController.h b/source/gameengine/GameLogic/SCA_ExpressionController.h
index d7bb8edebb1..38e3904a8d6 100644
--- a/source/gameengine/GameLogic/SCA_ExpressionController.h
+++ b/source/gameengine/GameLogic/SCA_ExpressionController.h
@@ -57,7 +57,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_ExpressionController"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_ExpressionController"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_IActuator.cpp b/source/gameengine/GameLogic/SCA_IActuator.cpp
index 9755d151fb3..b836227895f 100644
--- a/source/gameengine/GameLogic/SCA_IActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_IActuator.cpp
@@ -29,10 +29,6 @@
#include "SCA_IActuator.h"
#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
using namespace std;
SCA_IActuator::SCA_IActuator(SCA_IObject* gameobj, KX_ACTUATOR_TYPE type) :
diff --git a/source/gameengine/GameLogic/SCA_IActuator.h b/source/gameengine/GameLogic/SCA_IActuator.h
index f456183a16c..d3ead7c7460 100644
--- a/source/gameengine/GameLogic/SCA_IActuator.h
+++ b/source/gameengine/GameLogic/SCA_IActuator.h
@@ -157,7 +157,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_IActuator"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_IActuator"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_IController.cpp b/source/gameengine/GameLogic/SCA_IController.cpp
index c72dfcc696c..c291ff091aa 100644
--- a/source/gameengine/GameLogic/SCA_IController.cpp
+++ b/source/gameengine/GameLogic/SCA_IController.cpp
@@ -35,10 +35,6 @@
#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
SCA_IController::SCA_IController(SCA_IObject* gameobj)
:
SCA_ILogicBrick(gameobj),
diff --git a/source/gameengine/GameLogic/SCA_IInputDevice.h b/source/gameengine/GameLogic/SCA_IInputDevice.h
index b49168f325b..a13efee1316 100644
--- a/source/gameengine/GameLogic/SCA_IInputDevice.h
+++ b/source/gameengine/GameLogic/SCA_IInputDevice.h
@@ -230,6 +230,13 @@ public:
KX_F10KEY,
KX_F11KEY,
KX_F12KEY,
+ KX_F13KEY,
+ KX_F14KEY,
+ KX_F15KEY,
+ KX_F16KEY,
+ KX_F17KEY,
+ KX_F18KEY,
+ KX_F19KEY,
KX_PAUSEKEY,
KX_INSERTKEY,
@@ -309,8 +316,8 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_InputEvent"); }
- void operator delete( void *mem ) { MEM_freeN(mem); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_InputEvent"); }
+ void operator delete(void *mem) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
index b82fc4e2dd7..f2e1a8dd151 100644
--- a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
+++ b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
@@ -29,10 +29,6 @@
#include "SCA_ILogicBrick.h"
#include "PyObjectPlus.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
SCA_LogicManager* SCA_ILogicBrick::m_sCurrentLogicManager = NULL;
SCA_ILogicBrick::SCA_ILogicBrick(SCA_IObject* gameobj)
diff --git a/source/gameengine/GameLogic/SCA_IObject.cpp b/source/gameengine/GameLogic/SCA_IObject.cpp
index c43e5ed0598..7c0a5b2db15 100644
--- a/source/gameengine/GameLogic/SCA_IObject.cpp
+++ b/source/gameengine/GameLogic/SCA_IObject.cpp
@@ -35,10 +35,6 @@
#include "MT_Point3.h"
#include "ListValue.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
MT_Point3 SCA_IObject::m_sDummy=MT_Point3(0,0,0);
SG_QList SCA_IObject::m_activeBookmarkedControllers;
diff --git a/source/gameengine/GameLogic/SCA_IScene.cpp b/source/gameengine/GameLogic/SCA_IScene.cpp
index b11daf6653f..75e323efe94 100644
--- a/source/gameengine/GameLogic/SCA_IScene.cpp
+++ b/source/gameengine/GameLogic/SCA_IScene.cpp
@@ -29,10 +29,6 @@
#include "SCA_IScene.h"
#include "Value.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
SCA_DebugProp::SCA_DebugProp(): m_obj(NULL)
{
}
diff --git a/source/gameengine/GameLogic/SCA_IScene.h b/source/gameengine/GameLogic/SCA_IScene.h
index 7fd04e9d27f..93b040c9a31 100644
--- a/source/gameengine/GameLogic/SCA_IScene.h
+++ b/source/gameengine/GameLogic/SCA_IScene.h
@@ -72,7 +72,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_IScene"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_IScene"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
index c9c858fd868..fada69848b2 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ISensor.cpp
@@ -37,10 +37,6 @@
#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* Native functions */
void SCA_ISensor::ReParent(SCA_IObject* parent)
{
@@ -361,9 +357,8 @@ PyAttributeDef SCA_ISensor::Attributes[] = {
KX_PYATTRIBUTE_RO_FUNCTION("triggered", SCA_ISensor, pyattr_get_triggered),
KX_PYATTRIBUTE_RO_FUNCTION("positive", SCA_ISensor, pyattr_get_positive),
KX_PYATTRIBUTE_RO_FUNCTION("status", SCA_ISensor, pyattr_get_status),
- //KX_PYATTRIBUTE_TODO("links"),
- //KX_PYATTRIBUTE_TODO("posTicks"),
- //KX_PYATTRIBUTE_TODO("negTicks"),
+ KX_PYATTRIBUTE_RO_FUNCTION("pos_ticks", SCA_ISensor, pyattr_get_posTicks),
+ KX_PYATTRIBUTE_RO_FUNCTION("neg_ticks", SCA_ISensor, pyattr_get_negTicks),
{ NULL } //Sentinel
};
@@ -405,6 +400,18 @@ PyObject* SCA_ISensor::pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF
return PyLong_FromSsize_t(status);
}
+PyObject* SCA_ISensor::pyattr_get_posTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
+ return PyLong_FromLong(self->GetPosTicks());
+}
+
+PyObject* SCA_ISensor::pyattr_get_negTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
+ return PyLong_FromLong(self->GetNegTicks());
+}
+
int SCA_ISensor::pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
diff --git a/source/gameengine/GameLogic/SCA_ISensor.h b/source/gameengine/GameLogic/SCA_ISensor.h
index 42d06d856b6..2d3a3ef08a0 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.h
+++ b/source/gameengine/GameLogic/SCA_ISensor.h
@@ -167,6 +167,18 @@ public:
return m_prev_state;
}
+ /** get the number of ticks since the last positive pulse */
+ int GetPosTicks()
+ {
+ return m_pos_ticks;
+ }
+
+ /** get the number of ticks since the last negative pulse */
+ int GetNegTicks()
+ {
+ return m_neg_ticks;
+ }
+
/** Resume sensing. */
void Resume();
@@ -185,6 +197,9 @@ public:
static PyObject* pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_posTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_negTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+
static int pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_check_tap(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.cpp b/source/gameengine/GameLogic/SCA_JoystickManager.cpp
index 94330e52da9..5a975552d3d 100644
--- a/source/gameengine/GameLogic/SCA_JoystickManager.cpp
+++ b/source/gameengine/GameLogic/SCA_JoystickManager.cpp
@@ -30,9 +30,6 @@
//#include <vector>
#include "SCA_ISensor.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
//using namespace std;
diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.h b/source/gameengine/GameLogic/SCA_JoystickManager.h
index cde2e866815..e5f53442049 100644
--- a/source/gameengine/GameLogic/SCA_JoystickManager.h
+++ b/source/gameengine/GameLogic/SCA_JoystickManager.h
@@ -48,7 +48,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_JoystickManager"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_JoystickManager"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
index b79b014a161..29a6a73b865 100644
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
@@ -36,10 +36,6 @@
#include <iostream>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
SCA_JoystickSensor::SCA_JoystickSensor(class SCA_JoystickManager* eventmgr,
SCA_IObject* gameobj,
@@ -294,7 +290,6 @@ PyAttributeDef SCA_JoystickSensor::Attributes[] = {
KX_PYATTRIBUTE_RO_FUNCTION("numButtons", SCA_JoystickSensor, pyattr_get_num_buttons),
KX_PYATTRIBUTE_RO_FUNCTION("numHats", SCA_JoystickSensor, pyattr_get_num_hats),
KX_PYATTRIBUTE_RO_FUNCTION("connected", SCA_JoystickSensor, pyattr_get_connected),
- //KX_PYATTRIBUTE_TODO("events"),
{ NULL } //Sentinel
};
diff --git a/source/gameengine/GameLogic/SCA_KeyboardManager.h b/source/gameengine/GameLogic/SCA_KeyboardManager.h
index a9fe208eaca..53735f9fae1 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardManager.h
+++ b/source/gameengine/GameLogic/SCA_KeyboardManager.h
@@ -58,7 +58,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_KeyboardManager"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_KeyboardManager"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
index 224a3bbaf80..c49d65226dc 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
@@ -33,10 +33,6 @@
#include "StringValue.h"
#include "SCA_IInputDevice.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.cpp b/source/gameengine/GameLogic/SCA_LogicManager.cpp
index 9f9eb8a785f..d003c5618f1 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.cpp
+++ b/source/gameengine/GameLogic/SCA_LogicManager.cpp
@@ -36,10 +36,6 @@
#include "SCA_PythonController.h"
#include <set>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
SCA_LogicManager::SCA_LogicManager()
{
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h
index 85733275a45..c5f377eeb44 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.h
+++ b/source/gameengine/GameLogic/SCA_LogicManager.h
@@ -146,7 +146,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_LogicManager"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_LogicManager"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_MouseManager.cpp b/source/gameengine/GameLogic/SCA_MouseManager.cpp
index 4f5d199e163..f7f9a566c8d 100644
--- a/source/gameengine/GameLogic/SCA_MouseManager.cpp
+++ b/source/gameengine/GameLogic/SCA_MouseManager.cpp
@@ -30,10 +30,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#ifdef WIN32
// This warning tells us about truncation of __long__ stl-generated names.
// It can occasionally cause DevStudio to have internal compiler warnings.
@@ -44,12 +40,15 @@
#include "SCA_MouseManager.h"
#include "SCA_MouseSensor.h"
#include "IntValue.h"
+#include "RAS_ICanvas.h"
SCA_MouseManager::SCA_MouseManager(SCA_LogicManager* logicmgr,
- SCA_IInputDevice* mousedev)
+ SCA_IInputDevice* mousedev,
+ RAS_ICanvas* canvas)
: SCA_EventManager(logicmgr, MOUSE_EVENTMGR),
- m_mousedevice (mousedev)
+ m_mousedevice (mousedev),
+ m_canvas(canvas)
{
m_xpos = 0;
m_ypos = 0;
@@ -82,12 +81,13 @@ void SCA_MouseManager::NextFrame()
// coordinates
if (!mousesensor->IsSuspended())
{
- const SCA_InputEvent& event =
+ const SCA_InputEvent& event1 =
m_mousedevice->GetEventValue(SCA_IInputDevice::KX_MOUSEX);
- int mx = event.m_eventval;
const SCA_InputEvent& event2 =
m_mousedevice->GetEventValue(SCA_IInputDevice::KX_MOUSEY);
- int my = event2.m_eventval;
+
+ int mx = this->m_canvas->GetMouseX(event1.m_eventval);
+ int my = this->m_canvas->GetMouseY(event2.m_eventval);
mousesensor->setX(mx);
mousesensor->setY(my);
diff --git a/source/gameengine/GameLogic/SCA_MouseManager.h b/source/gameengine/GameLogic/SCA_MouseManager.h
index 82a8c996ef5..8bf060537ca 100644
--- a/source/gameengine/GameLogic/SCA_MouseManager.h
+++ b/source/gameengine/GameLogic/SCA_MouseManager.h
@@ -47,12 +47,13 @@ class SCA_MouseManager : public SCA_EventManager
{
class SCA_IInputDevice* m_mousedevice;
+ class RAS_ICanvas* m_canvas;
unsigned short m_xpos; // Cached location of the mouse pointer
unsigned short m_ypos;
public:
- SCA_MouseManager(class SCA_LogicManager* logicmgr,class SCA_IInputDevice* mousedev);
+ SCA_MouseManager(class SCA_LogicManager* logicmgr,class SCA_IInputDevice* mousedev, class RAS_ICanvas* canvas);
virtual ~SCA_MouseManager();
/**
@@ -66,7 +67,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_MouseManager"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_MouseManager"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.cpp b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
index 10835f13d54..9f4b25986b0 100644
--- a/source/gameengine/GameLogic/SCA_MouseSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
@@ -38,10 +38,6 @@
#include "ConstExpr.h"
#include <iostream>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_NANDController.cpp b/source/gameengine/GameLogic/SCA_NANDController.cpp
index 233adcb76dd..c09a53d8ac7 100644
--- a/source/gameengine/GameLogic/SCA_NANDController.cpp
+++ b/source/gameengine/GameLogic/SCA_NANDController.cpp
@@ -34,10 +34,6 @@
#include "SCA_LogicManager.h"
#include "BoolValue.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_NORController.cpp b/source/gameengine/GameLogic/SCA_NORController.cpp
index 7c0a4e89e22..8ebd79efcfa 100644
--- a/source/gameengine/GameLogic/SCA_NORController.cpp
+++ b/source/gameengine/GameLogic/SCA_NORController.cpp
@@ -34,10 +34,6 @@
#include "SCA_LogicManager.h"
#include "BoolValue.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_ORController.cpp b/source/gameengine/GameLogic/SCA_ORController.cpp
index 6df566f4695..a638147e211 100644
--- a/source/gameengine/GameLogic/SCA_ORController.cpp
+++ b/source/gameengine/GameLogic/SCA_ORController.cpp
@@ -34,10 +34,6 @@
#include "SCA_LogicManager.h"
#include "BoolValue.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
index 4ead0c54392..c1b49d32712 100644
--- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
@@ -34,10 +34,6 @@
#include "Operator2Expr.h"
#include "ConstExpr.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_PropertyEventManager.cpp b/source/gameengine/GameLogic/SCA_PropertyEventManager.cpp
index d78a9afbaca..f6a1b257c18 100644
--- a/source/gameengine/GameLogic/SCA_PropertyEventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertyEventManager.cpp
@@ -29,10 +29,6 @@
#include "SCA_ISensor.h"
#include "SCA_PropertyEventManager.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
SCA_PropertyEventManager::SCA_PropertyEventManager(class SCA_LogicManager* logicmgr)
: SCA_EventManager(logicmgr, PROPERTY_EVENTMGR)
diff --git a/source/gameengine/GameLogic/SCA_PropertyEventManager.h b/source/gameengine/GameLogic/SCA_PropertyEventManager.h
index 159b6d8b827..4e2920d9d70 100644
--- a/source/gameengine/GameLogic/SCA_PropertyEventManager.h
+++ b/source/gameengine/GameLogic/SCA_PropertyEventManager.h
@@ -46,7 +46,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_PropertyEventManager"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_PropertyEventManager"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
index 24dbdb94f95..be86b976a70 100644
--- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
@@ -41,10 +41,6 @@
#include "FloatValue.h"
#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
SCA_PropertySensor::SCA_PropertySensor(SCA_EventManager* eventmgr,
SCA_IObject* gameobj,
const STR_String& propname,
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index b7367221f80..1f05846abe4 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -43,10 +43,6 @@
#include <algorithm>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
// initialize static member variables
SCA_PythonController* SCA_PythonController::m_sCurrentController = NULL;
@@ -182,7 +178,7 @@ PyObject* SCA_PythonController::sPyGetCurrentController(PyObject *self)
{
if(m_sCurrentController==NULL)
{
- PyErr_SetString(PyExc_SystemError, "GameLogic.getCurrentController(), this function is being run outside the python controllers context, or blenders internal state is corrupt.");
+ PyErr_SetString(PyExc_SystemError, "bge.logic.getCurrentController(), this function is being run outside the python controllers context, or blenders internal state is corrupt.");
return NULL;
}
return m_sCurrentController->GetProxy();
@@ -268,7 +264,7 @@ void SCA_PythonController::ErrorPrint(const char *error_msg)
/* Added in 2.48a, the last_traceback can reference Objects for example, increasing
* their user count. Not to mention holding references to wrapped data.
* This is especially bad when the PyObject for the wrapped data is free'd, after blender
- * has alredy dealocated the pointer */
+ * has already dealocated the pointer */
PySys_SetObject( (char *)"last_traceback", NULL);
PyErr_Clear(); /* just to be sure */
}
@@ -299,49 +295,47 @@ bool SCA_PythonController::Import()
{
//printf("py module modified '%s'\n", m_scriptName.Ptr());
m_bModified= false;
-
+
/* incase we re-import */
Py_XDECREF(m_function);
m_function= NULL;
- vector<STR_String> py_function_path = m_scriptText.Explode('.');
-
- if(py_function_path.size() < 2) {
+ STR_String mod_path_str= m_scriptText; /* just for storage, use C style string access */
+ char *mod_path= mod_path_str.Ptr();
+ char *function_string;
+
+ function_string= strrchr(mod_path, '.');
+
+ if(function_string == NULL) {
printf("Python module name formatting error \"%s\":\n\texpected \"SomeModule.Func\", got \"%s\"\n", GetName().Ptr(), m_scriptText.Ptr());
return false;
}
-
- PyObject *mod = PyImport_ImportModule((char *)py_function_path[0].Ptr());
- /* Dont reload yet, do this within the loop so packages reload too */
-
- if(mod==NULL) {
- ErrorPrint("Python module not found");
+
+ *function_string= '\0';
+ function_string++;
+
+ // Import the module and print an error if it's not found
+ PyObject *mod = PyImport_ImportModule(mod_path);
+
+ if (mod == NULL) {
+ ErrorPrint("Python module can't be imported");
return false;
}
- /* 'mod' will be DECREF'd as 'base'
- * 'm_function' will be left holding a reference that the controller owns */
-
- PyObject *base= mod;
-
- for(unsigned int i=1; i < py_function_path.size(); i++) {
- if(m_debug && PyModule_Check(base)) { /* base could be a class */
- Py_DECREF(base); /* getting a new one so dont hold a ref to the old one */
- base= PyImport_ReloadModule(base);
- if (base==NULL) {
- m_function= NULL;
- break;
- }
- }
-
- m_function = PyObject_GetAttrString(base, py_function_path[i].Ptr());
- Py_DECREF(base);
- base = m_function; /* for the next loop if there is on */
-
- if(m_function==NULL) {
- break;
- }
+
+ if(m_debug)
+ mod = PyImport_ReloadModule(mod);
+
+ if (mod == NULL) {
+ ErrorPrint("Python module can't be reloaded");
+ return false;
}
-
+
+ // Get the function object
+ m_function = PyObject_GetAttrString(mod, function_string);
+
+ // DECREF the module as we don't need it anymore
+ Py_DECREF(mod);
+
if(m_function==NULL) {
if(PyErr_Occurred())
ErrorPrint("Python controller found the module but could not access the function");
@@ -456,7 +450,7 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
/* Added in 2.48a, the last_traceback can reference Objects for example, increasing
* their user count. Not to mention holding references to wrapped data.
* This is especially bad when the PyObject for the wrapped data is free'd, after blender
- * has alredy dealocated the pointer */
+ * has already dealocated the pointer */
PySys_SetObject( (char *)"last_traceback", NULL);
PyErr_Clear(); /* just to be sure */
}
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
new file mode 100644
index 00000000000..7951a749254
--- /dev/null
+++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
@@ -0,0 +1,104 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "SCA_PythonKeyboard.h"
+#include "SCA_IInputDevice.h"
+
+/* ------------------------------------------------------------------------- */
+/* Native functions */
+/* ------------------------------------------------------------------------- */
+
+SCA_PythonKeyboard::SCA_PythonKeyboard(SCA_IInputDevice* keyboard)
+: PyObjectPlus(),
+m_keyboard(keyboard)
+{
+}
+
+SCA_PythonKeyboard::~SCA_PythonKeyboard()
+{
+ /* intentionally empty */
+}
+
+#ifndef DISABLE_PYTHON
+
+/* ------------------------------------------------------------------------- */
+/* Python functions */
+/* ------------------------------------------------------------------------- */
+
+/* Integration hooks ------------------------------------------------------- */
+PyTypeObject SCA_PythonKeyboard::Type = {
+ PyVarObject_HEAD_INIT(NULL, 0)
+ "SCA_PythonKeyboard",
+ sizeof(PyObjectPlus_Proxy),
+ 0,
+ py_base_dealloc,
+ 0,
+ 0,
+ 0,
+ 0,
+ py_base_repr,
+ 0,0,0,0,0,0,0,0,0,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ 0,0,0,0,0,0,0,
+ Methods,
+ 0,
+ 0,
+ &PyObjectPlus::Type,
+ 0,0,0,0,0,0,
+ py_base_new
+};
+
+PyMethodDef SCA_PythonKeyboard::Methods[] = {
+ {NULL,NULL} //Sentinel
+};
+
+PyAttributeDef SCA_PythonKeyboard::Attributes[] = {
+ KX_PYATTRIBUTE_RO_FUNCTION("events", SCA_PythonKeyboard, pyattr_get_events),
+ { NULL } //Sentinel
+};
+
+PyObject* SCA_PythonKeyboard::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ SCA_PythonKeyboard* self = static_cast<SCA_PythonKeyboard*>(self_v);
+
+ PyObject* resultlist = PyList_New(0);
+
+ for (int i=SCA_IInputDevice::KX_BEGINKEY; i<=SCA_IInputDevice::KX_ENDKEY; i++)
+ {
+ const SCA_InputEvent & inevent = self->m_keyboard->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
+
+
+ if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
+ {
+ PyObject* keypair = PyTuple_New(2);
+ PyTuple_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i));
+ PyTuple_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status));
+ PyList_Append(resultlist, keypair);
+ }
+ }
+
+ return resultlist;
+}
+
+#endif
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.h b/source/gameengine/GameLogic/SCA_PythonKeyboard.h
new file mode 100644
index 00000000000..0b353ac444c
--- /dev/null
+++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.h
@@ -0,0 +1,44 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __KX_PYKEYBOARD
+#define __KX_PYKEYBOARD
+
+#include "PyObjectPlus.h"
+
+class SCA_PythonKeyboard : public PyObjectPlus
+{
+ Py_Header;
+ class SCA_IInputDevice *m_keyboard;
+public:
+ SCA_PythonKeyboard(class SCA_IInputDevice* keyboard);
+ virtual ~SCA_PythonKeyboard();
+
+#ifndef DISABLE_PYTHON
+ static PyObject* pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+#endif
+};
+
+#endif //__KX_PYKEYBOARD
+
diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
new file mode 100644
index 00000000000..041a0169879
--- /dev/null
+++ b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
@@ -0,0 +1,178 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "SCA_PythonMouse.h"
+#include "SCA_IInputDevice.h"
+#include "RAS_ICanvas.h"
+
+/* ------------------------------------------------------------------------- */
+/* Native functions */
+/* ------------------------------------------------------------------------- */
+
+SCA_PythonMouse::SCA_PythonMouse(SCA_IInputDevice* mouse, RAS_ICanvas* canvas)
+: PyObjectPlus(),
+m_mouse(mouse),
+m_canvas(canvas)
+{
+}
+
+SCA_PythonMouse::~SCA_PythonMouse()
+{
+ /* intentionally empty */
+}
+
+#ifndef DISABLE_PYTHON
+
+/* ------------------------------------------------------------------------- */
+/* Python functions */
+/* ------------------------------------------------------------------------- */
+
+/* Integration hooks ------------------------------------------------------- */
+PyTypeObject SCA_PythonMouse::Type = {
+ PyVarObject_HEAD_INIT(NULL, 0)
+ "SCA_PythonMouse",
+ sizeof(PyObjectPlus_Proxy),
+ 0,
+ py_base_dealloc,
+ 0,
+ 0,
+ 0,
+ 0,
+ py_base_repr,
+ 0,0,0,0,0,0,0,0,0,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ 0,0,0,0,0,0,0,
+ Methods,
+ 0,
+ 0,
+ &PyObjectPlus::Type,
+ 0,0,0,0,0,0,
+ py_base_new
+};
+
+PyMethodDef SCA_PythonMouse::Methods[] = {
+// KX_PYMETHODTABLE(SCA_PythonMouse, show),
+ {NULL,NULL} //Sentinel
+};
+
+PyAttributeDef SCA_PythonMouse::Attributes[] = {
+ KX_PYATTRIBUTE_RO_FUNCTION("events", SCA_PythonMouse, pyattr_get_events),
+ KX_PYATTRIBUTE_RW_FUNCTION("position", SCA_PythonMouse, pyattr_get_position, pyattr_set_position),
+ KX_PYATTRIBUTE_RW_FUNCTION("visible", SCA_PythonMouse, pyattr_get_visible, pyattr_set_visible),
+ { NULL } //Sentinel
+};
+
+PyObject* SCA_PythonMouse::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ SCA_PythonMouse* self = static_cast<SCA_PythonMouse*>(self_v);
+
+ PyObject* resultlist = PyList_New(0);
+
+ for (int i=SCA_IInputDevice::KX_BEGINMOUSE; i<=SCA_IInputDevice::KX_ENDMOUSE; i++)
+ {
+ const SCA_InputEvent & inevent = self->m_mouse->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
+
+
+ if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
+ {
+ PyObject* keypair = PyTuple_New(2);
+ PyTuple_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i));
+ PyTuple_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status));
+ PyList_Append(resultlist, keypair);
+ }
+ }
+
+ return resultlist;
+}
+
+PyObject* SCA_PythonMouse::pyattr_get_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ SCA_PythonMouse* self = static_cast<SCA_PythonMouse*>(self_v);
+ const SCA_InputEvent & xevent = self->m_mouse->GetEventValue(SCA_IInputDevice::KX_MOUSEX);
+ const SCA_InputEvent & yevent = self->m_mouse->GetEventValue(SCA_IInputDevice::KX_MOUSEY);
+
+ float x_coord, y_coord;
+
+ x_coord = self->m_canvas->GetMouseNormalizedX(xevent.m_eventval);
+ y_coord = self->m_canvas->GetMouseNormalizedY(yevent.m_eventval);
+
+ PyObject* ret = PyTuple_New(2);
+
+ PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(x_coord));
+ PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(y_coord));
+
+ return ret;
+}
+
+int SCA_PythonMouse::pyattr_set_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ SCA_PythonMouse* self = static_cast<SCA_PythonMouse*>(self_v);
+ int x, y;
+ float pyx, pyy;
+ if (!PyArg_ParseTuple(value, "ff:position", &pyx, &pyy))
+ return PY_SET_ATTR_FAIL;
+
+ x = (int)(pyx*self->m_canvas->GetWidth());
+ y = (int)(pyy*self->m_canvas->GetHeight());
+
+ self->m_canvas->SetMousePosition(x, y);
+
+ return PY_SET_ATTR_SUCCESS;
+}
+
+PyObject* SCA_PythonMouse::pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ SCA_PythonMouse* self = static_cast<SCA_PythonMouse*>(self_v);
+
+ int visible;
+
+ if (self->m_canvas->GetMouseState() == RAS_ICanvas::MOUSE_INVISIBLE)
+ visible = 0;
+ else
+ visible = 1;
+
+ return PyBool_FromLong(visible);
+}
+
+int SCA_PythonMouse::pyattr_set_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ SCA_PythonMouse* self = static_cast<SCA_PythonMouse*>(self_v);
+
+ int visible = PyObject_IsTrue(value);
+
+ if (visible == -1)
+ {
+ PyErr_SetString(PyExc_AttributeError, "SCA_PythonMouse.visible = bool: SCA_PythonMouse, expected True or False");
+ return PY_SET_ATTR_FAIL;
+ }
+
+ if (visible)
+ self->m_canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL);
+ else
+ self->m_canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE);
+
+ return PY_SET_ATTR_SUCCESS;
+}
+
+#endif
diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.h b/source/gameengine/GameLogic/SCA_PythonMouse.h
new file mode 100644
index 00000000000..c73e6683fc8
--- /dev/null
+++ b/source/gameengine/GameLogic/SCA_PythonMouse.h
@@ -0,0 +1,53 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __KX_PYMOUSE
+#define __KX_PYMOUSE
+
+#include "PyObjectPlus.h"
+
+class SCA_PythonMouse : public PyObjectPlus
+{
+ Py_Header;
+ class SCA_IInputDevice *m_mouse;
+ class RAS_ICanvas *m_canvas;
+public:
+ SCA_PythonMouse(class SCA_IInputDevice* mouse, class RAS_ICanvas* canvas);
+ virtual ~SCA_PythonMouse();
+
+ void Show(bool visible);
+
+#ifndef DISABLE_PYTHON
+ KX_PYMETHOD_DOC(SCA_PythonMouse, show);
+
+ static PyObject* pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_position(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static int pyattr_set_position(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value);
+ static PyObject* pyattr_get_visible(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static int pyattr_set_visible(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value);
+#endif
+};
+
+#endif //__KX_PYMOUSE
+
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
index ee9288cc0a6..4b90ca7dadf 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
@@ -37,10 +37,6 @@
#include "math.h"
#include "MT_Transform.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_RandomEventManager.cpp b/source/gameengine/GameLogic/SCA_RandomEventManager.cpp
index dc5aa3739ee..a0ffed57ba5 100644
--- a/source/gameengine/GameLogic/SCA_RandomEventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomEventManager.cpp
@@ -37,10 +37,6 @@ using namespace std;
#include <iostream>
#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
SCA_RandomEventManager::SCA_RandomEventManager(class SCA_LogicManager* logicmgr)
: SCA_EventManager(logicmgr, RANDOM_EVENTMGR)
{
diff --git a/source/gameengine/GameLogic/SCA_RandomEventManager.h b/source/gameengine/GameLogic/SCA_RandomEventManager.h
index 386ec886f06..51d233c4321 100644
--- a/source/gameengine/GameLogic/SCA_RandomEventManager.h
+++ b/source/gameengine/GameLogic/SCA_RandomEventManager.h
@@ -47,7 +47,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_RandomEventManager"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_RandomEventManager"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
index 644b0a4a9ea..f5cd4b07458 100644
--- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
@@ -37,10 +37,6 @@
#include <limits.h>
#include "SCA_RandomNumberGenerator.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* Period parameters */
#define N 624
#define M 397
diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h
index 1e644fe5c26..8402d0312fc 100644
--- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h
+++ b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h
@@ -77,7 +77,7 @@ class SCA_RandomNumberGenerator {
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_RandomNumberGenerator"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_RandomNumberGenerator"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.cpp b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
index 6605752a209..a7d18ff40d4 100644
--- a/source/gameengine/GameLogic/SCA_RandomSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
@@ -36,10 +36,6 @@
#include "ConstExpr.h"
#include <iostream>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp b/source/gameengine/GameLogic/SCA_TimeEventManager.cpp
index cb0d232ffa8..d794a4f1227 100644
--- a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_TimeEventManager.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#ifdef WIN32
// This warning tells us about truncation of __long__ stl-generated names.
diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.h b/source/gameengine/GameLogic/SCA_TimeEventManager.h
index ad4f343d137..b2a2eb5fe5d 100644
--- a/source/gameengine/GameLogic/SCA_TimeEventManager.h
+++ b/source/gameengine/GameLogic/SCA_TimeEventManager.h
@@ -52,7 +52,7 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_TimeEventManager"); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_TimeEventManager"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_XNORController.cpp b/source/gameengine/GameLogic/SCA_XNORController.cpp
index 73e45542ce4..9f54e41d110 100644
--- a/source/gameengine/GameLogic/SCA_XNORController.cpp
+++ b/source/gameengine/GameLogic/SCA_XNORController.cpp
@@ -34,10 +34,6 @@
#include "SCA_LogicManager.h"
#include "BoolValue.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_XORController.cpp b/source/gameengine/GameLogic/SCA_XORController.cpp
index ea7b162e7f3..a58f30a3bed 100644
--- a/source/gameengine/GameLogic/SCA_XORController.cpp
+++ b/source/gameengine/GameLogic/SCA_XORController.cpp
@@ -34,10 +34,6 @@
#include "SCA_LogicManager.h"
#include "BoolValue.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */