2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2010-05-29 07:25:38 +00:00
|
|
|
#ifndef ENGINE_CLIENT_INPUT_H
|
|
|
|
#define ENGINE_CLIENT_INPUT_H
|
|
|
|
|
|
|
|
class CInput : public IEngineInput
|
|
|
|
{
|
|
|
|
IEngineGraphics *m_pGraphics;
|
|
|
|
|
|
|
|
int m_InputGrabbed;
|
2015-08-25 12:24:46 +00:00
|
|
|
char *m_pClipboardText;
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2010-09-05 12:04:50 +00:00
|
|
|
int64 m_LastRelease;
|
|
|
|
int64 m_ReleaseDelta;
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2016-05-01 12:00:53 +00:00
|
|
|
bool m_MouseFocus;
|
2014-06-16 11:29:18 +00:00
|
|
|
int m_VideoRestartNeeded;
|
|
|
|
|
2016-04-30 02:02:32 +00:00
|
|
|
void AddEvent(char *pText, int Key, int Flags);
|
2016-04-30 18:11:26 +00:00
|
|
|
void Clear();
|
|
|
|
bool IsEventValid(CEvent *pEvent) const { return pEvent->m_InputCount == m_InputCounter; };
|
|
|
|
|
|
|
|
//quick access to input
|
|
|
|
unsigned short m_aInputCount[g_MaxKeys]; // tw-KEY
|
|
|
|
unsigned char m_aInputState[g_MaxKeys]; // SDL_SCANCODE
|
|
|
|
int m_InputCounter;
|
|
|
|
|
2016-08-15 04:01:31 +00:00
|
|
|
//ime support
|
2017-07-15 13:25:36 +00:00
|
|
|
int m_CountEditingText;
|
2016-08-15 04:01:31 +00:00
|
|
|
char m_pEditingText[32];
|
|
|
|
int m_EditingCursor;
|
|
|
|
|
2016-04-30 18:11:26 +00:00
|
|
|
bool KeyState(int Key) const;
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
IEngineGraphics *Graphics() { return m_pGraphics; }
|
|
|
|
|
|
|
|
public:
|
|
|
|
CInput();
|
|
|
|
|
|
|
|
virtual void Init();
|
|
|
|
|
2016-04-30 18:11:26 +00:00
|
|
|
bool KeyIsPressed(int Key) const { return KeyState(Key); }
|
|
|
|
bool KeyPress(int Key, bool CheckCounter) const { return CheckCounter ? (m_aInputCount[Key] == m_InputCounter) : m_aInputCount[Key]; }
|
2016-04-29 19:51:54 +00:00
|
|
|
|
2010-10-13 10:47:42 +00:00
|
|
|
virtual void MouseRelative(float *x, float *y);
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual void MouseModeAbsolute();
|
|
|
|
virtual void MouseModeRelative();
|
|
|
|
virtual int MouseDoubleClick();
|
2015-08-25 12:24:46 +00:00
|
|
|
virtual const char* GetClipboardText();
|
|
|
|
virtual void SetClipboardText(const char *Text);
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2010-12-11 21:04:50 +00:00
|
|
|
virtual int Update();
|
2016-04-30 22:18:25 +00:00
|
|
|
virtual void NextFrame();
|
2014-06-16 11:29:18 +00:00
|
|
|
|
|
|
|
virtual int VideoRestartNeeded();
|
2016-08-15 04:01:31 +00:00
|
|
|
|
2016-08-15 05:16:06 +00:00
|
|
|
virtual bool GetIMEState();
|
2017-07-15 13:25:36 +00:00
|
|
|
virtual void SetIMEState(bool Activate);
|
2016-08-15 04:01:31 +00:00
|
|
|
virtual const char* GetIMECandidate();
|
|
|
|
virtual int GetEditingCursor();
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|