Historique des modifications - Message

Message #3614

Sujet: XML comment sa marche ?


TypeDateAuteurContenu
Création du message25-02-2008 11:52:49marco565
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

Retour

OptionsLiens officielsCaractéristiquesStatistiquesCommunauté
Préférences cookies
Corrections
irrlicht
irrklang
irredit
irrxml
Propulsé par Django
xhtml 1.0
css 2.1
884 membres
1441 sujets
11339 messages
Dernier membre inscrit: Saidov17
88 invités en ligne
membre en ligne: -
RSS Feed