forked from bartvdbraak/blender
BGE Bugfix
The End key didn't work work at all for the keyboard sensor. Removed getEventList() since it was added since 2.48a release.
This commit is contained in:
parent
b0cca7de26
commit
ac45472a17
@ -74,7 +74,7 @@ void KX_BlenderKeyboardDevice::NextFrame()
|
||||
|
||||
// now convert justpressed keyevents into regular (active) keyevents
|
||||
int previousTable = 1-m_currentTable;
|
||||
for (int keyevent= KX_BEGINKEY; keyevent< KX_ENDKEY;keyevent++)
|
||||
for (int keyevent= KX_BEGINKEY; keyevent<= KX_ENDKEY;keyevent++)
|
||||
{
|
||||
SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][keyevent];
|
||||
if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
|
||||
@ -100,7 +100,7 @@ bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode,short v
|
||||
KX_EnumInputs kxevent = this->ToNative(incode);
|
||||
|
||||
// only process it, if it's a key
|
||||
if (kxevent >= KX_BEGINKEY && kxevent < KX_ENDKEY)
|
||||
if (kxevent >= KX_BEGINKEY && kxevent <= KX_ENDKEY)
|
||||
{
|
||||
int previousTable = 1-m_currentTable;
|
||||
|
||||
|
@ -148,7 +148,7 @@ bool SCA_KeyboardSensor::Evaluate(CValue* eventval)
|
||||
bool justreleased = false;
|
||||
bool active = false;
|
||||
|
||||
for (int i=SCA_IInputDevice::KX_BEGINKEY ; i< SCA_IInputDevice::KX_ENDKEY;i++)
|
||||
for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++)
|
||||
{
|
||||
const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i);
|
||||
switch (inevent.m_status)
|
||||
@ -387,7 +387,7 @@ void SCA_KeyboardSensor::LogKeystrokes(void)
|
||||
int index = 0;
|
||||
/* Check on all keys whether they were pushed. This does not
|
||||
* untangle the ordering, so don't type too fast :) */
|
||||
for (int i=SCA_IInputDevice::KX_BEGINKEY ; i< SCA_IInputDevice::KX_ENDKEY;i++)
|
||||
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) //NO_INPUTSTATUS)
|
||||
@ -522,7 +522,7 @@ PyObject* SCA_KeyboardSensor::PyGetPressedKeys(PyObject* self, PyObject* args, P
|
||||
|
||||
int index = 0;
|
||||
|
||||
for (int i=SCA_IInputDevice::KX_BEGINKEY ; i< SCA_IInputDevice::KX_ENDKEY;i++)
|
||||
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)
|
||||
@ -562,7 +562,7 @@ PyObject* SCA_KeyboardSensor::PyGetCurrentlyPressedKeys(PyObject* self, PyObject
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for (int i=SCA_IInputDevice::KX_BEGINKEY ; i< SCA_IInputDevice::KX_ENDKEY;i++)
|
||||
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)
|
||||
@ -583,30 +583,6 @@ PyObject* SCA_KeyboardSensor::PyGetCurrentlyPressedKeys(PyObject* self, PyObject
|
||||
return resultlist;
|
||||
}
|
||||
|
||||
|
||||
KX_PYMETHODDEF_DOC_NOARGS(SCA_KeyboardSensor, getEventList,
|
||||
"getEventList()\n"
|
||||
"\tGet the list of the keyboard events in this frame.\n")
|
||||
{
|
||||
ShowDeprecationWarning("getEventList()", "events");
|
||||
|
||||
SCA_IInputDevice* inputdev = m_pKeyboardMgr->GetInputDevice();
|
||||
|
||||
PyObject* resultlist = PyList_New(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_NO_INPUTSTATUS)
|
||||
{
|
||||
PyObject* keypair = PyList_New(2);
|
||||
PyList_SET_ITEM(keypair,0,PyInt_FromLong(i));
|
||||
PyList_SetItem(keypair,1,PyInt_FromLong(inevent.m_status));
|
||||
PyList_Append(resultlist,keypair);
|
||||
}
|
||||
}
|
||||
return resultlist;
|
||||
}
|
||||
//<---- Deprecated
|
||||
|
||||
KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus,
|
||||
@ -673,7 +649,6 @@ PyMethodDef SCA_KeyboardSensor::Methods[] = {
|
||||
{"getPressedKeys", (PyCFunction) SCA_KeyboardSensor::sPyGetPressedKeys, METH_VARARGS, (PY_METHODCHAR)GetPressedKeys_doc},
|
||||
{"getCurrentlyPressedKeys", (PyCFunction) SCA_KeyboardSensor::sPyGetCurrentlyPressedKeys, METH_VARARGS, (PY_METHODCHAR)GetCurrentlyPressedKeys_doc},
|
||||
//<----- Deprecated
|
||||
KX_PYMETHODTABLE_NOARGS(SCA_KeyboardSensor, getEventList),
|
||||
KX_PYMETHODTABLE_O(SCA_KeyboardSensor, getKeyStatus),
|
||||
{NULL,NULL} //Sentinel
|
||||
};
|
||||
@ -709,7 +684,7 @@ PyObject* SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBU
|
||||
|
||||
PyObject* resultlist = PyList_New(0);
|
||||
|
||||
for (int i=SCA_IInputDevice::KX_BEGINKEY ; i< SCA_IInputDevice::KX_ENDKEY;i++)
|
||||
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_NO_INPUTSTATUS)
|
||||
|
@ -42,7 +42,7 @@ void GPC_KeyboardDevice::NextFrame()
|
||||
|
||||
// Now convert justpressed key events into regular (active) keyevents
|
||||
int previousTable = 1-m_currentTable;
|
||||
for (int keyevent= KX_BEGINKEY; keyevent< KX_ENDKEY;keyevent++)
|
||||
for (int keyevent= KX_BEGINKEY; keyevent<= KX_ENDKEY;keyevent++)
|
||||
{
|
||||
SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][keyevent];
|
||||
if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
|
||||
@ -69,7 +69,7 @@ bool GPC_KeyboardDevice::ConvertEvent(int incode, int val)
|
||||
KX_EnumInputs kxevent = this->ToNative(incode);
|
||||
|
||||
// only process it, if it's a key
|
||||
if (kxevent >= KX_BEGINKEY && kxevent < KX_ENDKEY)
|
||||
if (kxevent >= KX_BEGINKEY && kxevent <= KX_ENDKEY)
|
||||
{
|
||||
int previousTable = 1-m_currentTable;
|
||||
|
||||
@ -114,9 +114,7 @@ bool GPC_KeyboardDevice::ConvertEvent(int incode, int val)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(kxevent==KX_ENDKEY) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -31,15 +31,6 @@ class SCA_KeyboardSensor(SCA_ISensor):
|
||||
|
||||
@type events: list [[keycode, status], ...]
|
||||
"""
|
||||
def getEventList():
|
||||
"""
|
||||
Get a list of pressed keys that have either been pressed, or just released, or are active this frame.
|
||||
|
||||
B{DEPRECATED: Use the "events" property instead}.
|
||||
|
||||
@rtype: list of key status. [[keycode, status]]
|
||||
@return: A list of keyboard events
|
||||
"""
|
||||
|
||||
def getKeyStatus(keycode):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user