Historique des modifications - Message

Message #3614

Sujet: XML comment sa marche ?


Type Date Auteur Contenu
Création du message 25-02-2008 11:52:49 marco565
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

Options Liens officiels Caractéristiques Statistiques Communauté
Préférences cookies
Corrections
irrlicht
irrklang
irredit
irrxml
Propulsé par Django
xhtml 1.0
css 2.1
884 membres
1440 sujets
11337 messages
Dernier membre inscrit: Saidov17
105 invités en ligne
membre en ligne: -
RSS Feed