[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14651] trunk/blender/source/gameengine/ GameLogic: Fix BGE bug #8863: Keyboard Sensor does not send negative pulse if key released while scene suspended .
Benoit Bolsee
benoit.bolsee at online.be
Thu May 1 22:43:18 CEST 2008
Revision: 14651
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14651
Author: ben2610
Date: 2008-05-01 22:43:18 +0200 (Thu, 01 May 2008)
Log Message:
-----------
Fix BGE bug #8863: Keyboard Sensor does not send negative pulse if key released while scene suspended. The fix covers keyboard and mouse sensor
Modified Paths:
--------------
trunk/blender/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
trunk/blender/source/gameengine/GameLogic/SCA_MouseSensor.cpp
Modified: trunk/blender/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp 2008-05-01 20:31:57 UTC (rev 14650)
+++ trunk/blender/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp 2008-05-01 20:43:18 UTC (rev 14651)
@@ -163,6 +163,23 @@
{
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 @@
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 @@
{
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;
+ }
+ }
}
}
}
Modified: trunk/blender/source/gameengine/GameLogic/SCA_MouseSensor.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_MouseSensor.cpp 2008-05-01 20:31:57 UTC (rev 14650)
+++ trunk/blender/source/gameengine/GameLogic/SCA_MouseSensor.cpp 2008-05-01 20:43:18 UTC (rev 14651)
@@ -158,6 +158,23 @@
{
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 @@
{
m_val = 0;
result = true;
+ } else
+ {
+ if (m_val == 1)
+ {
+ m_val = 0;
+ result = true;
+ }
}
}
break;
More information about the Bf-blender-cvs
mailing list