Loading XML and createDevice

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Joey Peters

Loading XML and createDevice

Post by Joey Peters »

I want to load a configuration file in XML which holds the width and height of the to create device. But for a XML reader to work, you need a device already. So I first create one, get the XML reader from it, drop it, and create a new device with the width and height from the XML reader. But, once you closeDevice() a device, the next device will always return false with .run()! So, how am I going to read a XML file with Irrlichts XML reader which holds information about the to create device? And why would .run() always return false if you dropped the first device, can't I just reinstanciate it?
jyon
Posts: 3
Joined: Wed Mar 30, 2005 5:34 am
Location: south korea
Contact:

Post by jyon »

well what I do is like this :

Code: Select all

Device = createDevice(video::EDT_NULL);
FileManager = Device->getFileManager();
LoadConfig(); // do the xml stuff here
Device->drop(); // drop NULL device
Device = createDevice(deviceType,windowSize,bits,fullscreen,stensilbuffer,vsync);
// do what you wanna do here...
Device->drop();

well the code works for me , dunno if its right way ..

jyon
eXodus
Posts: 320
Joined: Tue Jan 04, 2005 10:07 am
Location: Canada
Contact:

Post by eXodus »

I wouldn't say its the right way, but its how you do it with Irrlicht's XML reader.
jyon
Posts: 3
Joined: Wed Mar 30, 2005 5:34 am
Location: south korea
Contact:

Post by jyon »

eXodus wrote:I wouldn't say its the right way, but its how you do it with Irrlicht's XML reader.
but I thought the question was "how you get the XML reader working"

all I meant was don't closeDevice() a device just drop() it
and createDevice() a device again with the info you loaded in XML config file.
then it wouldn't return false with .run()

jyon
eXodus
Posts: 320
Joined: Tue Jan 04, 2005 10:07 am
Location: Canada
Contact:

Post by eXodus »

I meant, creating a NULL device in order to get the XML reader is weird. NX++ has a better way to do this.

Your coding was good according to Irrlicht's inner working.
WalterWzK
Posts: 72
Joined: Wed Jan 12, 2005 2:57 pm
Location: Netherlands
Contact:

Post by WalterWzK »

lol eXodus, even using the NX verion is the wrong approach...

Why dont we use a (self-made or) build-in XML Reader within the application.. you guys wanna do everything with irrlicht, but loading the config settings for example would be better to load with a programmed class rather than setting up a fake-device to use its capability's...

When i started last year on my game in VB.Net there where no input\events for .NET, i had to program my own low-level hooks..
Current Project: Don Salvatore's Mafia
Genre: 3D Shooter \ RTS
Programming Language: VB .NET
Engine: Irrlicht 11 [.NET Wrapper]
eXodus
Posts: 320
Joined: Tue Jan 04, 2005 10:07 am
Location: Canada
Contact:

Post by eXodus »

I prefer dedicated third party libraries. TinyXML or SQLite will always do a better job at IO operations.
Post Reply