| Precedente :: Successivo |
| Autore |
Messaggio |
PMax
Registrato: 17/06/06 10:24 Messaggi: 7
|
Inviato: Dom Nov 01, 2009 5:24 pm Oggetto: Caricamento file xml |
|
|
Ciao a tutti.
mi potete dare una mano ?
ho scrittoun un file xml e vorrei caricarlo nel progetto che sto facendo per settare il video::E_DRIVER_TYPE
| Codice: |
<?xml version='1.0'?>
<config>
<DriverType value='video::EDT_DIRECT3D9'/>
</config>
|
Main
| Codice: |
// create the reader using one of the factory functions
IrrXMLReader* xml = createIrrXMLReader("config.xml");
if(xml == 0)
{
std::cout<<"Failed to open the file"<<std::endl;
}
// strings for storing the data we want to get out of the file
std::string drType;
// 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
break;
case io::EXN_ELEMENT:
if (!strcmp("DriverType", xml->getNodeName()))
drType = xml->getAttributeValue("value");
cout<<drType<<endl;
break;
}
}
// delete the xml parser after usage
delete xml;
|
Caricarre carica e risco a leggere il comando drType ma non riesco a prendere il suo valore " video::EDT_DIRECT3D9 " e inserirlo nel createdevice()
| Codice: |
// create device and exit if creation failed
IrrlichtDevice* device =
createDevice(drType, core::dimension2d<u32>(640, 480));
if (device == 0)
return 1; // could not create selected driver. |
mi da errore
| Codice: |
'irr::createDevice': impossibile convertire il parametro 1 da 'std::string' a 'irr::video::E_DRIVER_TYPE' |
che comando devo usare?
Grazie.
ps:
non sono programmatore, sto provando a modificare il codice del file esempio "come caricare il file scena.Irr ". |
|
| Top |
|
 |
PMax
Registrato: 17/06/06 10:24 Messaggi: 7
|
Inviato: Mer Nov 11, 2009 2:49 pm Oggetto: |
|
|
Ciao a tutti.
Girando sul forum di irrlicht ho trovato un progetto "settingsReader" che contiene un file "settings.h" da includere nel progetto,cosi ho eliminato il file xml.
ciao.  |
|
| Top |
|
 |
|
|
Non puoi inserire nuovi argomenti Non puoi rispondere a nessun argomento Non puoi modificare i tuoi messaggi Non puoi cancellare i tuoi messaggi Non puoi votare nei sondaggi
|
|