implementation for getText

This commit is contained in:
Lendemor 2016-12-14 12:53:02 +01:00
parent f74e9dfdb4
commit 660413ea7f
2 changed files with 9 additions and 1 deletions

View File

@ -47,7 +47,7 @@ void Input::updateEvents(){
break; break;
case sf::Event::TextEntered: case sf::Event::TextEntered:
c = (char) event.text.unicode; c = (char) event.text.unicode;
m_buffer.append(&c); m_buffer.push_back(c);
break; break;
case sf::Event::KeyPressed: case sf::Event::KeyPressed:
m_actions.push_back(kb.getPressedAction(event.key.code)); m_actions.push_back(kb.getPressedAction(event.key.code));
@ -152,6 +152,13 @@ float Input::getDeltaVerticalScroll() const
return m_delta_vertical_scroll; return m_delta_vertical_scroll;
} }
std::string Input::getText()
{
std::string t = m_buffer;
m_buffer.clear();
return t;
}
/* ------ */ /* ------ */
void Input::test() void Input::test()

View File

@ -18,6 +18,7 @@ struct Binding{
int type; int type;
}; };
//write a function to add new Binding?
class IKeysMap{ class IKeysMap{
public: public:
enum {PRESSED, RELEASED, HOLD}; enum {PRESSED, RELEASED, HOLD};