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 GAME_CLIENT_LINEINPUT_H
|
|
|
|
#define GAME_CLIENT_LINEINPUT_H
|
|
|
|
|
|
|
|
#include <engine/input.h>
|
|
|
|
|
|
|
|
// line input helter
|
|
|
|
class CLineInput
|
|
|
|
{
|
|
|
|
char m_Str[256];
|
|
|
|
int m_Len;
|
|
|
|
int m_CursorPos;
|
|
|
|
public:
|
|
|
|
static bool Manipulate(IInput::CEvent e, char *pStr, int StrMaxSize, int *pStrLenPtr, int *pCursorPosPtr);
|
|
|
|
|
|
|
|
class CCallback
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~CCallback() {}
|
|
|
|
virtual bool Event(IInput::CEvent e) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
CLineInput();
|
|
|
|
void Clear();
|
|
|
|
void ProcessInput(IInput::CEvent e);
|
|
|
|
void Set(const char *pString);
|
|
|
|
const char *GetString() const { return m_Str; }
|
|
|
|
int GetLength() const { return m_Len; }
|
2010-11-17 17:36:19 +00:00
|
|
|
int GetCursorOffset() const { return m_CursorPos; }
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|