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:
authorNick Samarin <nicks1987@bigmir.net>2010-10-03 20:28:28 +0400
committerNick Samarin <nicks1987@bigmir.net>2010-10-03 20:28:28 +0400
commit90ab716cd5214b23f98fa7bc31b5df002a198fa7 (patch)
tree8427f09c85826fbdb8187e1868c6bc95f8a20e5c /source/gameengine/GameLogic
parentee0f4e8d76f603a9f3a5f6b037ad4b98084cda42 (diff)
parentcfc4399ab3dfd2ec3346ec087e835664e04b1599 (diff)
synched with trunk at revision 32129
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r--source/gameengine/GameLogic/CMakeLists.txt2
-rw-r--r--source/gameengine/GameLogic/Joystick/Makefile2
-rw-r--r--source/gameengine/GameLogic/Makefile2
-rw-r--r--source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_AlwaysSensor.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_DelaySensor.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.cpp17
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.h15
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickSensor.cpp1
-rw-r--r--source/gameengine/GameLogic/SCA_LogicManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_MouseManager.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_PythonKeyboard.cpp23
-rw-r--r--source/gameengine/GameLogic/SCA_PythonKeyboard.h4
-rw-r--r--source/gameengine/GameLogic/SCA_PythonMouse.cpp27
-rw-r--r--source/gameengine/GameLogic/SCA_PythonMouse.h4
-rw-r--r--source/gameengine/GameLogic/SCA_TimeEventManager.cpp3
-rw-r--r--source/gameengine/GameLogic/SConscript12
18 files changed, 75 insertions, 49 deletions
diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt
index 93183dafeee..84d915847e9 100644
--- a/source/gameengine/GameLogic/CMakeLists.txt
+++ b/source/gameengine/GameLogic/CMakeLists.txt
@@ -43,7 +43,7 @@ ELSE(WITH_SDL)
ENDIF(WITH_SDL)
IF(WITH_PYTHON)
- SET(INC ${INC} ${PYTHON_INC})
+ LIST(APPEND INC ${PYTHON_INC})
ELSE(WITH_PYTHON)
ADD_DEFINITIONS(-DDISABLE_PYTHON)
ENDIF(WITH_PYTHON)
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 ba1e1c25ee7..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.
diff --git a/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp b/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp
index 9a6ed25a203..db741040ccc 100644
--- a/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp
@@ -61,4 +61,4 @@ void SCA_ActuatorEventManager::UpdateFrame()
{
(*it)->Update();
}
-} \ No newline at end of file
+}
diff --git a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp b/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
index 0f3b81a057e..e364225af3d 100644
--- a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
@@ -29,7 +29,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef WIN32
+#if defined(WIN32) && !defined(FREE_WINDOWS)
// This warning tells us about truncation of __long__ stl-generated names.
// It can occasionally cause DevStudio to have internal compiler warnings.
#pragma warning( disable : 4786 )
diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.cpp b/source/gameengine/GameLogic/SCA_DelaySensor.cpp
index 701bcb2fc2f..6cad801e429 100644
--- a/source/gameengine/GameLogic/SCA_DelaySensor.cpp
+++ b/source/gameengine/GameLogic/SCA_DelaySensor.cpp
@@ -29,7 +29,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef WIN32
+#if defined(WIN32) && !defined(FREE_WINDOWS)
// This warning tells us about truncation of __long__ stl-generated names.
// It can occasionally cause DevStudio to have internal compiler warnings.
#pragma warning( disable : 4786 )
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
index bff02326c9c..fada69848b2 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ISensor.cpp
@@ -357,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
};
@@ -401,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_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
index 5ab42ae7608..29a6a73b865 100644
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
@@ -290,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_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h
index c5f377eeb44..9ddb62df361 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.h
+++ b/source/gameengine/GameLogic/SCA_LogicManager.h
@@ -30,7 +30,7 @@
#ifndef __KX_LOGICMANAGER
#define __KX_LOGICMANAGER
-#ifdef WIN32
+#if defined(WIN32) && !defined(FREE_WINDOWS)
#pragma warning (disable:4786)
#endif
diff --git a/source/gameengine/GameLogic/SCA_MouseManager.cpp b/source/gameengine/GameLogic/SCA_MouseManager.cpp
index f7f9a566c8d..1241bd07229 100644
--- a/source/gameengine/GameLogic/SCA_MouseManager.cpp
+++ b/source/gameengine/GameLogic/SCA_MouseManager.cpp
@@ -30,7 +30,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef WIN32
+#if defined(WIN32) && !defined(FREE_WINDOWS)
// This warning tells us about truncation of __long__ stl-generated names.
// It can occasionally cause DevStudio to have internal compiler warnings.
#pragma warning( disable : 4786 )
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index 48fdcb3eb44..1f05846abe4 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -178,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();
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
index 7951a749254..3d5d3568335 100644
--- a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
@@ -33,11 +33,17 @@ SCA_PythonKeyboard::SCA_PythonKeyboard(SCA_IInputDevice* keyboard)
: PyObjectPlus(),
m_keyboard(keyboard)
{
+#ifndef DISABLE_PYTHON
+ m_event_dict = PyDict_New();
+#endif
}
SCA_PythonKeyboard::~SCA_PythonKeyboard()
{
- /* intentionally empty */
+#ifndef DISABLE_PYTHON
+ PyDict_Clear(m_event_dict);
+ Py_DECREF(m_event_dict);
+#endif
}
#ifndef DISABLE_PYTHON
@@ -81,24 +87,15 @@ PyAttributeDef SCA_PythonKeyboard::Attributes[] = {
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);
- }
+ PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status));
}
-
- return resultlist;
+ Py_INCREF(self->m_event_dict);
+ return self->m_event_dict;
}
#endif
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.h b/source/gameengine/GameLogic/SCA_PythonKeyboard.h
index 0b353ac444c..260835155e6 100644
--- a/source/gameengine/GameLogic/SCA_PythonKeyboard.h
+++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.h
@@ -30,7 +30,11 @@
class SCA_PythonKeyboard : public PyObjectPlus
{
Py_Header;
+private:
class SCA_IInputDevice *m_keyboard;
+#ifndef DISABLE_PYTHON
+ PyObject* m_event_dict;
+#endif
public:
SCA_PythonKeyboard(class SCA_IInputDevice* keyboard);
virtual ~SCA_PythonKeyboard();
diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
index 041a0169879..936ee2ff5c4 100644
--- a/source/gameengine/GameLogic/SCA_PythonMouse.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
@@ -35,11 +35,17 @@ SCA_PythonMouse::SCA_PythonMouse(SCA_IInputDevice* mouse, RAS_ICanvas* canvas)
m_mouse(mouse),
m_canvas(canvas)
{
+#ifndef DISABLE_PYTHON
+ m_event_dict = PyDict_New();
+#endif
}
SCA_PythonMouse::~SCA_PythonMouse()
{
- /* intentionally empty */
+#ifndef DISABLE_PYTHON
+ PyDict_Clear(m_event_dict);
+ Py_DECREF(m_event_dict);
+#endif
}
#ifndef DISABLE_PYTHON
@@ -72,7 +78,6 @@ PyTypeObject SCA_PythonMouse::Type = {
};
PyMethodDef SCA_PythonMouse::Methods[] = {
-// KX_PYMETHODTABLE(SCA_PythonMouse, show),
{NULL,NULL} //Sentinel
};
@@ -86,26 +91,18 @@ PyAttributeDef SCA_PythonMouse::Attributes[] = {
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);
- }
+ PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status));
}
-
- return resultlist;
+ Py_INCREF(self->m_event_dict);
+ return self->m_event_dict;
}
+
PyObject* SCA_PythonMouse::pyattr_get_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_PythonMouse* self = static_cast<SCA_PythonMouse*>(self_v);
diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.h b/source/gameengine/GameLogic/SCA_PythonMouse.h
index c73e6683fc8..9e1085e6bec 100644
--- a/source/gameengine/GameLogic/SCA_PythonMouse.h
+++ b/source/gameengine/GameLogic/SCA_PythonMouse.h
@@ -30,8 +30,12 @@
class SCA_PythonMouse : public PyObjectPlus
{
Py_Header;
+private:
class SCA_IInputDevice *m_mouse;
class RAS_ICanvas *m_canvas;
+#ifndef DISABLE_PYTHON
+ PyObject* m_event_dict;
+#endif
public:
SCA_PythonMouse(class SCA_IInputDevice* mouse, class RAS_ICanvas* canvas);
virtual ~SCA_PythonMouse();
diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp b/source/gameengine/GameLogic/SCA_TimeEventManager.cpp
index d794a4f1227..8b99fd669a9 100644
--- a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_TimeEventManager.cpp
@@ -26,8 +26,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef WIN32
-
+#if defined(WIN32) && !defined(FREE_WINDOWS)
// This warning tells us about truncation of __long__ stl-generated names.
// It can occasionally cause DevStudio to have internal compiler warnings.
#pragma warning( disable : 4786 )
diff --git a/source/gameengine/GameLogic/SConscript b/source/gameengine/GameLogic/SConscript
index 3840754ed06..507bb7f0bdd 100644
--- a/source/gameengine/GameLogic/SConscript
+++ b/source/gameengine/GameLogic/SConscript
@@ -10,17 +10,17 @@ incs += ' #/source/gameengine/Rasterizer #/source/gameengine/SceneGraph'
defs = []
if env['WITH_BF_SDL']:
- incs += ' ' + env['BF_SDL_INC']
+ incs += ' ' + env['BF_SDL_INC']
else:
- defs.append('DISABLE_SDL')
+ defs.append('DISABLE_SDL')
if env['WITH_BF_PYTHON']:
- incs += ' ' + env['BF_PYTHON_INC']
+ incs += ' ' + env['BF_PYTHON_INC']
else:
- defs.append('DISABLE_PYTHON')
+ defs.append('DISABLE_PYTHON')
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
- if env['BF_DEBUG']:
- defs.append('_DEBUG')
+ if env['BF_DEBUG']:
+ defs.append('_DEBUG')
env.BlenderLib ( 'bf_logic', sources, Split(incs), defs, libtype=['core','player'], priority=[330,65], cxx_compileflags=env['BGE_CXXFLAGS'])