Convert a irr::c8 to a wchar_t*
-
09-06-2021 - |
Question
I'm making a 3D environment, and I want to make it so that when you pass the crosshair over an object, some text with its description pops up. But I have this really annoying string format thing in the way.
info.setText(CollMan->getSceneNodeFromScreenCoordinatesBB(blah)->getName());
info being the text object, and getSceneNodeblahblah->getName being the description that I want.
This doesnt work, because setText wants a wchar_t* and getName() provides an irr::c8. .c_str() doesn't seem to help whatsoever.
How can I get these two to play nice?
Solution
If I'm reading the docs correctly you ought to be able to do it by converting it to an irr::core::stringw first as follows:
info.setText( irr::core::stringw( CollMan->getSceneNodeFromScreenCoordinatesBB(blah)->getName() ).c_str() );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow