forked from bartvdbraak/blender
Fix BGE bug #8863: Keyboard Sensor does not send negative pulse if key released while scene suspended. The fix covers keyboard and mouse sensor
This commit is contained in:
parent
57b819301c
commit
d99ddc5cf8
@ -163,6 +163,23 @@ bool SCA_KeyboardSensor::Evaluate(CValue* eventval)
|
||||
{
|
||||
m_val=(active)?1:0;
|
||||
result = true;
|
||||
} else
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
if (m_val == 0)
|
||||
{
|
||||
m_val = 1;
|
||||
result = true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (m_val == 1)
|
||||
{
|
||||
m_val = 0;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,6 +195,13 @@ bool SCA_KeyboardSensor::Evaluate(CValue* eventval)
|
||||
|
||||
if (inevent.m_status == SCA_InputEvent::KX_NO_INPUTSTATUS)
|
||||
{
|
||||
if (m_val == 1)
|
||||
{
|
||||
// this situation may occur after a scene suspend: the keyboard release
|
||||
// event was not captured, produce now the event off
|
||||
m_val = 0;
|
||||
result = true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED)
|
||||
@ -190,6 +214,18 @@ bool SCA_KeyboardSensor::Evaluate(CValue* eventval)
|
||||
{
|
||||
m_val = 0;
|
||||
result = true;
|
||||
} else
|
||||
{
|
||||
if (inevent.m_status == SCA_InputEvent::KX_ACTIVE)
|
||||
{
|
||||
if (m_val == 0)
|
||||
{
|
||||
// this may occur during a scene suspend, the keyboard
|
||||
// press was not captured, do it now
|
||||
m_val = 1;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -158,6 +158,23 @@ bool SCA_MouseSensor::Evaluate(CValue* event)
|
||||
{
|
||||
m_val = 0;
|
||||
result = true;
|
||||
} else
|
||||
{
|
||||
if (event.m_status == SCA_InputEvent::KX_ACTIVE)
|
||||
{
|
||||
if (m_val == 0)
|
||||
{
|
||||
m_val = 1;
|
||||
result = true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (m_val == 1)
|
||||
{
|
||||
m_val = 0;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -183,6 +200,13 @@ bool SCA_MouseSensor::Evaluate(CValue* event)
|
||||
{
|
||||
m_val = 0;
|
||||
result = true;
|
||||
} else
|
||||
{
|
||||
if (m_val == 1)
|
||||
{
|
||||
m_val = 0;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user