diff options
| author | BeaR <cinaera@web.de> | 2012-05-02 13:53:28 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2013-02-24 17:39:31 +0100 |
| commit | 0adaf8a75206bcc3cdba5c4eadd5014a3d696aff (patch) | |
| tree | dd97762cb94f1e7ae02d9dac09b0301867d068ef /src | |
| parent | 86fe9757c5ca48349bf6d4035ffa33f745026a7e (diff) | |
| download | zcatch-0adaf8a75206bcc3cdba5c4eadd5014a3d696aff.tar.gz zcatch-0adaf8a75206bcc3cdba5c4eadd5014a3d696aff.zip | |
#913
Fix Input Handling
Diffstat (limited to 'src')
| -rw-r--r-- | src/engine/client/input.cpp | 13 | ||||
| -rw-r--r-- | src/engine/input.h | 7 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp index 0b4a44a4..7ff8d6fe 100644 --- a/src/engine/client/input.cpp +++ b/src/engine/client/input.cpp @@ -35,6 +35,7 @@ CInput::CInput() m_InputCurrent = 0; m_InputGrabbed = 0; + m_InputDispatched = false; m_LastRelease = 0; m_ReleaseDelta = -1; @@ -116,10 +117,14 @@ int CInput::Update() /*if(!input_grabbed && Graphics()->WindowActive()) Input()->MouseModeRelative();*/ - // clear and begin count on the other one - m_InputCurrent^=1; - mem_zero(&m_aInputCount[m_InputCurrent], sizeof(m_aInputCount[m_InputCurrent])); - mem_zero(&m_aInputState[m_InputCurrent], sizeof(m_aInputState[m_InputCurrent])); + if(m_InputDispatched) + { + // clear and begin count on the other one + m_InputCurrent^=1; + mem_zero(&m_aInputCount[m_InputCurrent], sizeof(m_aInputCount[m_InputCurrent])); + mem_zero(&m_aInputState[m_InputCurrent], sizeof(m_aInputState[m_InputCurrent])); + m_InputDispatched = false; + } { int i; diff --git a/src/engine/input.h b/src/engine/input.h index 7d28be10..93ceccd2 100644 --- a/src/engine/input.h +++ b/src/engine/input.h @@ -38,6 +38,7 @@ protected: unsigned char m_aInputState[2][1024]; int m_InputCurrent; + bool m_InputDispatched; int KeyWasPressed(int Key) { return m_aInputState[m_InputCurrent^1][Key]; } @@ -51,7 +52,11 @@ public: // events int NumEvents() const { return m_NumEvents; } - void ClearEvents() { m_NumEvents = 0; } + void ClearEvents() + { + m_NumEvents = 0; + m_InputDispatched = true; + } CEvent GetEvent(int Index) const { if(Index < 0 || Index >= m_NumEvents) |