diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-08-26 02:51:18 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-08-26 02:51:18 +0400 |
commit | 0a23895f95382a8c6d5c36bc8b36802c4474eb2e (patch) | |
tree | a9f852821ebe443a9035efb9ffb86059f2f4e7fb /source/gameengine/GameLogic/SCA_KeyboardSensor.cpp | |
parent | 6a5773d4a8633374a1f54864c077a0cd5fa122ea (diff) |
remove all python api functions deprecated in 2.49
Diffstat (limited to 'source/gameengine/GameLogic/SCA_KeyboardSensor.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_KeyboardSensor.cpp | 188 |
1 files changed, 0 insertions, 188 deletions
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp index 13b32b5446c..d2e3871fec2 100644 --- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp +++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp @@ -408,184 +408,6 @@ void SCA_KeyboardSensor::LogKeystrokes(void) /* Python Functions */ /* ------------------------------------------------------------------------- */ -//Deprecated -----> -/** 1. GetKey : check which key this sensor looks at */ -const char SCA_KeyboardSensor::GetKey_doc[] = -"getKey()\n" -"\tReturn the code of the key this sensor is listening to.\n" ; -PyObject* SCA_KeyboardSensor::PyGetKey() -{ - ShowDeprecationWarning("getKey()", "the key property"); - return PyLong_FromSsize_t(m_hotkey); -} - -/** 2. SetKey: change the key to look at */ -const char SCA_KeyboardSensor::SetKey_doc[] = -"setKey(keycode)\n" -"\t- keycode: any code from GameKeys\n" -"\tSet the key this sensor should listen to.\n" ; -PyObject* SCA_KeyboardSensor::PySetKey(PyObject* args) -{ - ShowDeprecationWarning("setKey()", "the key property"); - int keyCode; - - if(!PyArg_ParseTuple(args, "i:setKey", &keyCode)) { - return NULL; - } - - /* Since we have symbolic constants for this in Python, we don't guard */ - /* anything. It's up to the user to provide a sensible number. */ - m_hotkey = keyCode; - - Py_RETURN_NONE; -} - -/** 3. GetHold1 : set the first bucky bit */ -const char SCA_KeyboardSensor::GetHold1_doc[] = -"getHold1()\n" -"\tReturn the code of the first key modifier to the key this \n" -"\tsensor is listening to.\n" ; -PyObject* SCA_KeyboardSensor::PyGetHold1() -{ - ShowDeprecationWarning("getHold1()", "the hold1 property"); - return PyLong_FromSsize_t(m_qual); -} - -/** 4. SetHold1: change the first bucky bit */ -const char SCA_KeyboardSensor::SetHold1_doc[] = -"setHold1(keycode)\n" -"\t- keycode: any code from GameKeys\n" -"\tSet the first modifier to the key this sensor should listen to.\n" ; -PyObject* SCA_KeyboardSensor::PySetHold1(PyObject* args) -{ - ShowDeprecationWarning("setHold1()", "the hold1 property"); - int keyCode; - - if(!PyArg_ParseTuple(args, "i:setHold1", &keyCode)) { - return NULL; - } - - /* Since we have symbolic constants for this in Python, we don't guard */ - /* anything. It's up to the user to provide a sensible number. */ - m_qual = keyCode; - - Py_RETURN_NONE; -} - -/** 5. GetHold2 : get the second bucky bit */ -const char SCA_KeyboardSensor::GetHold2_doc[] = -"getHold2()\n" -"\tReturn the code of the second key modifier to the key this \n" -"\tsensor is listening to.\n" ; -PyObject* SCA_KeyboardSensor::PyGetHold2() -{ - ShowDeprecationWarning("getHold2()", "the hold2 property"); - return PyLong_FromSsize_t(m_qual2); -} - -/** 6. SetHold2: change the second bucky bit */ -const char SCA_KeyboardSensor::SetHold2_doc[] = -"setHold2(keycode)\n" -"\t- keycode: any code from GameKeys\n" -"\tSet the first modifier to the key this sensor should listen to.\n" ; -PyObject* SCA_KeyboardSensor::PySetHold2(PyObject* args) -{ - ShowDeprecationWarning("setHold2()", "the hold2 property"); - int keyCode; - - if(!PyArg_ParseTuple(args, "i:setHold2", &keyCode)) { - return NULL; - } - - /* Since we have symbolic constants for this in Python, we don't guard */ - /* anything. It's up to the user to provide a sensible number. */ - m_qual2 = keyCode; - - Py_RETURN_NONE; -} - - -const char SCA_KeyboardSensor::GetPressedKeys_doc[] = -"getPressedKeys()\n" -"\tGet a list of pressed keys that have either been pressed, or just released this frame.\n" ; - -PyObject* SCA_KeyboardSensor::PyGetPressedKeys() -{ - ShowDeprecationWarning("getPressedKeys()", "events"); - - SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); - - int num = inputdev->GetNumJustEvents(); - PyObject* resultlist = PyList_New(num); - - if (num > 0) - { - - int index = 0; - - for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++) - { - const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i); - if ((inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED) - || (inevent.m_status == SCA_InputEvent::KX_JUSTRELEASED)) - { - PyObject* keypair = PyList_New(2); - PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i)); - PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status)); - PyList_SET_ITEM(resultlist,index,keypair); - index++; - - if (index >= num) /* should not happen */ - break; - } - } - } - - return resultlist; -} - - - -const char SCA_KeyboardSensor::GetCurrentlyPressedKeys_doc[] = -"getCurrentlyPressedKeys()\n" -"\tGet a list of keys that are currently pressed.\n" ; - -PyObject* SCA_KeyboardSensor::PyGetCurrentlyPressedKeys() -{ - ShowDeprecationWarning("getCurrentlyPressedKeys()", "events"); - - SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); - - int num = inputdev->GetNumActiveEvents(); - PyObject* resultlist = PyList_New(num); - - if (num > 0) - { - int index = 0; - - for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++) - { - const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i); - if ( (inevent.m_status == SCA_InputEvent::KX_ACTIVE) - || (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED)) - { - PyObject* keypair = PyList_New(2); - PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i)); - PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status)); - PyList_SET_ITEM(resultlist,index,keypair); - index++; - - if (index >= num) /* should never happen */ - break; - } - } - } - - return resultlist; -} - -//<---- Deprecated - KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus, "getKeyStatus(keycode)\n" "\tGet the given key's status (KX_NO_INPUTSTATUS, KX_JUSTACTIVATED, KX_ACTIVE or KX_JUSTRELEASED).\n") @@ -635,16 +457,6 @@ PyTypeObject SCA_KeyboardSensor::Type = { }; PyMethodDef SCA_KeyboardSensor::Methods[] = { - //Deprecated functions ------> - {"getKey", (PyCFunction) SCA_KeyboardSensor::sPyGetKey, METH_NOARGS, (const char *)GetKey_doc}, - {"setKey", (PyCFunction) SCA_KeyboardSensor::sPySetKey, METH_VARARGS, (const char *)SetKey_doc}, - {"getHold1", (PyCFunction) SCA_KeyboardSensor::sPyGetHold1, METH_NOARGS, (const char *)GetHold1_doc}, - {"setHold1", (PyCFunction) SCA_KeyboardSensor::sPySetHold1, METH_VARARGS, (const char *)SetHold1_doc}, - {"getHold2", (PyCFunction) SCA_KeyboardSensor::sPyGetHold2, METH_NOARGS, (const char *)GetHold2_doc}, - {"setHold2", (PyCFunction) SCA_KeyboardSensor::sPySetHold2, METH_VARARGS, (const char *)SetHold2_doc}, - {"getPressedKeys", (PyCFunction) SCA_KeyboardSensor::sPyGetPressedKeys, METH_NOARGS, (const char *)GetPressedKeys_doc}, - {"getCurrentlyPressedKeys", (PyCFunction) SCA_KeyboardSensor::sPyGetCurrentlyPressedKeys, METH_NOARGS, (const char *)GetCurrentlyPressedKeys_doc}, - //<----- Deprecated KX_PYMETHODTABLE_O(SCA_KeyboardSensor, getKeyStatus), {NULL,NULL} //Sentinel }; |