IrrXML : Help loading model

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
charl3s7
Posts: 11
Joined: Sat Oct 03, 2009 3:17 am

IrrXML : Help loading model

Post by charl3s7 »

Code:

Code: Select all

	while(xml && xml->read())
	 {
		if(!strcmp("mainwindow",xml->getNodeName())){
			messageText = xml->getAttributeValue("title");
			fullscreen = xml->getAttributeValueAsInt("fullscreen");
		}
		if(!strcmp("mdl",xml->getNodeName())){
			std::string map = xml->getAttributeValue("src");
			IMeshSceneNode* mesh = smgr->addMeshSceneNode(smgr->getMesh(mp));
		}		   
	 }
config.xml

Code: Select all

<?xml version="1.0"?>
<config>
   <mdl src="map/main.x"/>
   <mainwindow title="Game Test" fullscreen=1></mainwindow>
</config>
What I'm trying to do is load "src" from the mdl tag and make an object with it. But I don't know how to convert the xml->getAttributeValue("src"); to c8. Help?
//Charles
Eigen
Competition winner
Posts: 375
Joined: Fri Jan 27, 2006 2:01 pm
Location: Estonia
Contact:

Post by Eigen »

You could do:

Code: Select all

      if(!strcmp("mdl",xml->getNodeName())){
         stringc modelfile = stringc( xml->getAttributeValue("src") );
         IMeshSceneNode* mesh = smgr->addMeshSceneNode(smgr->getMesh(modelfile.c_str()));
      } 
Post Reply