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/SCA_KeyboardSensor.cpp')
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardSensor.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
index 4898dbed95f..c276f42e0ff 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
@@ -137,17 +137,22 @@ bool SCA_KeyboardSensor::Evaluate(CValue* eventval)
{
bool justactivated = false;
bool justreleased = false;
+ bool active = false;
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)
- {
+ switch (inevent.m_status)
+ {
+ case SCA_InputEvent::KX_JUSTACTIVATED:
justactivated = true;
- }
- if (inevent.m_status == SCA_InputEvent::KX_JUSTRELEASED)
- {
+ break;
+ case SCA_InputEvent::KX_JUSTRELEASED:
justreleased = true;
+ break;
+ case SCA_InputEvent::KX_ACTIVE:
+ active = true;
+ break;
}
}
@@ -159,7 +164,7 @@ bool SCA_KeyboardSensor::Evaluate(CValue* eventval)
{
if (justreleased)
{
- m_val=0;
+ m_val=(active)?1:0;
result = true;
}
}