1

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?

Magicaxis
  • 371
  • 7
  • 16
  • More info. What’s the type of `info`? Is it an Irrlicht object as well? Otherwise, why doesn’t it accept `irr::c8`? That would both be easier and a better design. `wchar_t` in general should be avoided. – Konrad Rudolph May 15 '12 at 11:48
  • info is a irr::gui::IGUIStaticText. I'd love to avoid wchar_t, i just dont know how to make setText accept something else. – Magicaxis May 15 '12 at 12:01

1 Answers1

2

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() );
Goz
  • 61,365
  • 24
  • 124
  • 204
  • @MagicAxis: I found the docs by literally doing a search for irr::c8 ;) – Goz May 15 '12 at 14:14
  • LOL I swear I googled that too, and all i found was a somewhat related forum post and a definition of a c8! Aah well, cheers :3 – Magicaxis May 16 '12 at 00:26
  • @Magicaxis: I did have to do a bit more searching around the docs but you get used to finding "what ought to be there" when you've dealt with enough APIs ;) – Goz May 16 '12 at 14:05