diff --git a/src/input.cpp b/src/input.cpp index 7055caf..42c7bf8 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -47,7 +47,7 @@ void Input::updateEvents(){ break; case sf::Event::TextEntered: c = (char) event.text.unicode; - m_buffer.append(&c); + m_buffer.push_back(c); break; case sf::Event::KeyPressed: m_actions.push_back(kb.getPressedAction(event.key.code)); @@ -152,6 +152,13 @@ float Input::getDeltaVerticalScroll() const return m_delta_vertical_scroll; } +std::string Input::getText() +{ + std::string t = m_buffer; + m_buffer.clear(); + return t; +} + /* ------ */ void Input::test() diff --git a/src/keybindings.h b/src/keybindings.h index 840a0d9..5a1b7b0 100644 --- a/src/keybindings.h +++ b/src/keybindings.h @@ -18,6 +18,7 @@ struct Binding{ int type; }; +//write a function to add new Binding? class IKeysMap{ public: enum {PRESSED, RELEASED, HOLD};