#1
merci de votre aide
25-02-2008 11:52:49
- marco565
- Membres
- Date d'inscription:
- Messages: 25
- IP: 82.249.159.118
- Courriel
bonjour j'essaye de comprendre le fonctionnement de irrlicht avec xml, j'ai troouvé un exemple sur le net mais je n'arrive pas a recupere les donnees contenue dans le fichier .xml
voici le code:
#include <iostream>
#include <irr/irrlicht.h>
using namespace std;
using namespace irr;
using namespace io;
int main()
{
IrrlichtDevice *device = createDevice(video::EDT_DIRECT3D9);
scene::ISceneManager *scene = device->getSceneManager();
video::IVideoDriver *driver = device->getVideoDriver();
//une cam
scene->addCameraSceneNode(0, core::vector3df(0,0,-10), core::vector3df(0,0,0));
//Un fichier xml
// 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;
}
}
cout<<messageText<<modelFile<<caption<<endl;//Sa mache pas
while(device->run())
{
driver->beginScene(true,true, video::SColor(255,100,100,100));
scene->drawAll();
driver->endScene();
}
device->drop();
return 0;
}merci de votre aide
Hors ligne
#2
26-02-2008 13:26:46
- gp2mv3
- Membres
- Date d'inscription:
- Messages: 103
- IP: 130.104.80.7
- Courriel Site web
Salut,
Personnelement, j'utilise tinyXML, qui est bien pratique pour les petites utilisations.
Il est simple et il y a pas mal de tuto sur internet.
Bien amicalement.
Gp2mv3
Hors ligne
#3
26-02-2008 19:13:47
- marco565
- Membres
- Date d'inscription:
- Messages: 25
- IP: 82.255.78.1
- Courriel
ok je vais regarder sa merci
Hors ligne



