help with irrXML

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
darkfox404
Posts: 26
Joined: Thu Mar 02, 2006 3:49 am

help with irrXML

Post by darkfox404 »

i don't under stand it is it only

Code: Select all

#include <irrXML.h>
using namespace irr; // irrXML is located 
using namespace io;  // in the namespace irr::io

#include <string> // we use STL strings to store data
                  // in this example

void main()
{
  // create the reader using one of the factory functions
  IrrXMLReader* xml = createIrrXMLReader("config.xml");

  // strings for storing the data we want to get out of the file
  std::string modelFile;
  std::string messageText;
  std::string caption;

  // parse the file until end reached

  while(xml && xml->read())
  {
    switch(xml->getNodeType())
    {
    case EXN_TEXT:
       // in this xml file, the only text which
       // occurs is the messageText
       messageText = xml->getNodeData();
       break;
    case EXN_ELEMENT:
       if (!strcmp("model", xml->getNodeName()))
         modelFile = xml->getAttributeValue("file");
       else
       if (!strcmp("messageText", xml->getNodeName()))
         caption = xml->getAttributeValue("caption");
       break;
    }
  }

  // delete the xml parser after usage
  delete xml;
}

Code: Select all

<?xml version="1.0"?>
<config>
   <!-- This is a config file for the mesh viewer -->
   <model file="dwarf.dea" />
   <messageText caption="Irrlicht Engine Mesh Viewer">
     Welcome to the Mesh Viewer of the "Irrlicht Engine".
   </messageText>
</config>
And that will load a model and a 3d world or is there a lot too it??
and also (im not sure from reading the code but) do you custom make your params or is it riged that way... and would it be possible to make a param for bump mapping and other effects??? im a noob...
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

First this doesn't load a file or world. And there is a little bit more to do than just this tp load the model and map.
It just loads the strings in the " into the strings
std::string modelFile;
std::string messageText;
std::string caption;

Second this format is not fixed u can add every value u want.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Post Reply