mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
parent
86fe9757c5
commit
0adaf8a752
|
@ -35,6 +35,7 @@ CInput::CInput()
|
||||||
|
|
||||||
m_InputCurrent = 0;
|
m_InputCurrent = 0;
|
||||||
m_InputGrabbed = 0;
|
m_InputGrabbed = 0;
|
||||||
|
m_InputDispatched = false;
|
||||||
|
|
||||||
m_LastRelease = 0;
|
m_LastRelease = 0;
|
||||||
m_ReleaseDelta = -1;
|
m_ReleaseDelta = -1;
|
||||||
|
@ -116,10 +117,14 @@ int CInput::Update()
|
||||||
/*if(!input_grabbed && Graphics()->WindowActive())
|
/*if(!input_grabbed && Graphics()->WindowActive())
|
||||||
Input()->MouseModeRelative();*/
|
Input()->MouseModeRelative();*/
|
||||||
|
|
||||||
|
if(m_InputDispatched)
|
||||||
|
{
|
||||||
// clear and begin count on the other one
|
// clear and begin count on the other one
|
||||||
m_InputCurrent^=1;
|
m_InputCurrent^=1;
|
||||||
mem_zero(&m_aInputCount[m_InputCurrent], sizeof(m_aInputCount[m_InputCurrent]));
|
mem_zero(&m_aInputCount[m_InputCurrent], sizeof(m_aInputCount[m_InputCurrent]));
|
||||||
mem_zero(&m_aInputState[m_InputCurrent], sizeof(m_aInputState[m_InputCurrent]));
|
mem_zero(&m_aInputState[m_InputCurrent], sizeof(m_aInputState[m_InputCurrent]));
|
||||||
|
m_InputDispatched = false;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -38,6 +38,7 @@ protected:
|
||||||
|
|
||||||
unsigned char m_aInputState[2][1024];
|
unsigned char m_aInputState[2][1024];
|
||||||
int m_InputCurrent;
|
int m_InputCurrent;
|
||||||
|
bool m_InputDispatched;
|
||||||
|
|
||||||
int KeyWasPressed(int Key) { return m_aInputState[m_InputCurrent^1][Key]; }
|
int KeyWasPressed(int Key) { return m_aInputState[m_InputCurrent^1][Key]; }
|
||||||
|
|
||||||
|
@ -51,7 +52,11 @@ public:
|
||||||
|
|
||||||
// events
|
// events
|
||||||
int NumEvents() const { return m_NumEvents; }
|
int NumEvents() const { return m_NumEvents; }
|
||||||
void ClearEvents() { m_NumEvents = 0; }
|
void ClearEvents()
|
||||||
|
{
|
||||||
|
m_NumEvents = 0;
|
||||||
|
m_InputDispatched = true;
|
||||||
|
}
|
||||||
CEvent GetEvent(int Index) const
|
CEvent GetEvent(int Index) const
|
||||||
{
|
{
|
||||||
if(Index < 0 || Index >= m_NumEvents)
|
if(Index < 0 || Index >= m_NumEvents)
|
||||||
|
|
Loading…
Reference in a new issue