mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
Split CInput::NextFrame() from CInput::Update() (fixes #444)
This commit is contained in:
parent
a0a7d96ca0
commit
72a6e20ba8
|
@ -2809,6 +2809,7 @@ void CClient::Run()
|
||||||
}
|
}
|
||||||
m_pGraphics->Swap();
|
m_pGraphics->Swap();
|
||||||
}
|
}
|
||||||
|
Input()->NextFrame();
|
||||||
}
|
}
|
||||||
if(Input()->VideoRestartNeeded())
|
if(Input()->VideoRestartNeeded())
|
||||||
{
|
{
|
||||||
|
|
|
@ -126,18 +126,19 @@ bool CInput::KeyState(int Key) const
|
||||||
return m_aInputState[Key>=KEY_MOUSE_1 ? Key : SDL_GetScancodeFromKey(KeyToKeycode(Key))];
|
return m_aInputState[Key>=KEY_MOUSE_1 ? Key : SDL_GetScancodeFromKey(KeyToKeycode(Key))];
|
||||||
}
|
}
|
||||||
|
|
||||||
int CInput::Update()
|
void CInput::NextFrame()
|
||||||
{
|
{
|
||||||
// keep the counter between 1..0xFFFF, 0 means not pressed
|
|
||||||
m_InputCounter = (m_InputCounter%0xFFFF)+1;
|
|
||||||
|
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
const Uint8 *pState = SDL_GetKeyboardState(&i);
|
const Uint8 *pState = SDL_GetKeyboardState(&i);
|
||||||
if(i >= KEY_LAST)
|
if(i >= KEY_LAST)
|
||||||
i = KEY_LAST-1;
|
i = KEY_LAST-1;
|
||||||
mem_copy(m_aInputState, pState, i);
|
mem_copy(m_aInputState, pState, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CInput::Update()
|
||||||
|
{
|
||||||
|
// keep the counter between 1..0xFFFF, 0 means not pressed
|
||||||
|
m_InputCounter = (m_InputCounter%0xFFFF)+1;
|
||||||
|
|
||||||
// these states must always be updated manually because they are not in the GetKeyState from SDL
|
// these states must always be updated manually because they are not in the GetKeyState from SDL
|
||||||
int i = SDL_GetMouseState(NULL, NULL);
|
int i = SDL_GetMouseState(NULL, NULL);
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
virtual void SetClipboardText(const char *Text);
|
virtual void SetClipboardText(const char *Text);
|
||||||
|
|
||||||
virtual int Update();
|
virtual int Update();
|
||||||
|
virtual void NextFrame();
|
||||||
|
|
||||||
virtual int VideoRestartNeeded();
|
virtual int VideoRestartNeeded();
|
||||||
};
|
};
|
||||||
|
|
|
@ -76,6 +76,7 @@ class IEngineInput : public IInput
|
||||||
public:
|
public:
|
||||||
virtual void Init() = 0;
|
virtual void Init() = 0;
|
||||||
virtual int Update() = 0;
|
virtual int Update() = 0;
|
||||||
|
virtual void NextFrame() = 0;
|
||||||
virtual int VideoRestartNeeded() = 0;
|
virtual int VideoRestartNeeded() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue