switched from string to wstring

This commit is contained in:
Lendemor 2017-01-22 17:50:49 +01:00
parent d3e7128f87
commit 8b7d644958
2 changed files with 7 additions and 6 deletions

View File

@ -55,7 +55,9 @@ void Input::updateEvents(){
break;
case sf::Event::TextEntered:
c = (char) event.text.unicode;
m_buffer.push_back(c);
sf::Utf32::encodeAnsi(event.text.unicode,std::back_inserter(m_buffer));
// std::cout << << std::endl;
// m_buffer.push_back('\u9190');
break;
case sf::Event::KeyPressed:
action = kb.getPressedAction(event.key.code);
@ -182,10 +184,9 @@ void Input::setMouseGrabbed(bool isGrabbed)
m_last_mouse_position = sf::Vector2i(m_window->getSize())/2;
}
std::string Input::getText()
std::wstring Input::getText()
{
std::string t = m_buffer;
return t;
return m_buffer;
}
/* ------ */

View File

@ -38,7 +38,7 @@ private:
bool m_mouseGrabbed;
/* text-related variable */
std::string m_buffer;
std::wstring m_buffer;
public:
/* Constructors */
Input(sf::Window *w);
@ -72,7 +72,7 @@ public:
bool isMouseGrabbed() const { return m_mouseGrabbed; }
/* text-related function */
std::string getText();
std::wstring getText();
void test();
};