I'm creating text in SFML 2.1 (It doesn't really matter) in c++.
Setting a text string looks like that: text.setString("something");
Ok, but because my game language is Polish, I have to enter some characters like ą,ż,ł,ś,ć etc. , which are not 'supported' in my game's ASCII encoding.
Iv'e came up with this solution: text.setString(L"śomęthińg");
But problems appear when you try to combine wstring and string from another function. For example:
text.setString(L"Name: " + PlayerName() );
I've tried converting it to string or creating temporary variables, but either did not work, or it erased this 'special characters'...
FULL EXAMPLE:
std::string PlayerName()
{
std::string name = "John";
return name;
}
int main()
{
sf::Text hello;
hello.setString(L"Hello " + PlayerName() + L", how are you?");
//I need to use L" "
window.draw(hello);
}
Any idea?