What string format is getMesh looking for?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
gedditoffme
Posts: 5
Joined: Sat Nov 01, 2008 3:15 am

What string format is getMesh looking for?

Post by gedditoffme »

Hello,

I'm having trouble getting something to compile. I'm trying to use smgr->getMesh() with an std::string.

I'm writing a generic model loader function, so I guess I don't really care whether I pass it std strings or not, but after a while trawling through the API I can't work out what string format getMesh is actually looking for :S
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: What string format is getMesh looking for?

Post by randomMesh »

According to the API, virtual IAnimatedMesh* irr::scene::ISceneManager::getMesh(const io::path &filename), takes a constant reference to an io::path object.

According to the API again, io::path is a

Code: Select all

typedef core::string<fschar_t> irr::io::path
No go ahead an figure out what fschar_t is. :)

There's an overload which takes a pointer to an io::IReadFile, though.
"Whoops..."
gedditoffme
Posts: 5
Joined: Sat Nov 01, 2008 3:15 am

Post by gedditoffme »

LOL, I really have no idea what any of that means.

if I had a function
MeshLoader(string file){
getMesh(file);
}

what type should that string be? Is it possible to convert from that type to others (and vice-versa)?

declaring it a path, or a core::string<fschar_t> don't work for me (keep getting compiler errors, and I am including "irrString.h")
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

Code: Select all

MeshLoader(const std::string& file)
{ 
     getMesh(file.c_str()); 
}
Simple as that. And use constant references rather than copy by value.
"Whoops..."
gedditoffme
Posts: 5
Joined: Sat Nov 01, 2008 3:15 am

Post by gedditoffme »

Thanks a lot :D

Got it working now.
Post Reply