added clipboard to CInput

This commit is contained in:
Zwelf 2017-06-19 11:30:35 +02:00
parent 101b883ca6
commit 501cbea8c1
3 changed files with 28 additions and 0 deletions

View file

@ -39,12 +39,18 @@ CInput::CInput()
m_InputCounter = 1;
m_InputGrabbed = 0;
m_pClipboardText = 0;
m_MouseDoubleClick = false;
m_NumEvents = 0;
}
CInput::~CInput()
{
free(m_pClipboardText);
}
void CInput::Init()
{
m_pGraphics = Kernel()->RequestInterface<IEngineGraphics>();
@ -103,6 +109,21 @@ int CInput::MouseDoubleClick()
return 0;
}
const char *CInput::GetClipboardText()
{
if(m_pClipboardText)
{
free(m_pClipboardText);
}
m_pClipboardText = SDL_GetClipboardText();
return m_pClipboardText;
}
void CInput::SetClipboardText(const char *pText)
{
SDL_SetClipboardText(pText);
}
void CInput::Clear()
{
mem_zero(m_aInputState, sizeof(m_aInputState));

View file

@ -9,6 +9,7 @@ class CInput : public IEngineInput
IConsole *m_pConsole;
int m_InputGrabbed;
char *m_pClipboardText;
bool m_MouseDoubleClick;
@ -28,6 +29,7 @@ class CInput : public IEngineInput
public:
CInput();
~CInput();
virtual void Init();
@ -38,6 +40,8 @@ public:
virtual void MouseModeAbsolute();
virtual void MouseModeRelative();
virtual int MouseDoubleClick();
virtual const char *GetClipboardText();
virtual void SetClipboardText(const char *pText);
virtual int Update();
};

View file

@ -63,6 +63,9 @@ public:
virtual void MouseModeRelative() = 0;
virtual void MouseModeAbsolute() = 0;
virtual int MouseDoubleClick() = 0;
virtual const char* GetClipboardText() = 0;
virtual void SetClipboardText(const char *Text) = 0;
virtual void MouseRelative(float *x, float *y) = 0;
};