GUI XML Parser ?

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
IceFire_darkalex
Posts: 3
Joined: Mon Sep 01, 2008 1:08 pm

GUI XML Parser ?

Post by IceFire_darkalex »

Hi!

I'm searching for that since 2 hours now. I have seen the GUI Editor example but I cannot find a Sourcecode of it... So I want to ask you if Irrlicht has an XML-Reader built in which can read GUI Structures directly from XML Files?

Example XML:

Code: Select all

<?xml version="1.0"?>
<element type="button">

	<attributes>
		<int name="Id" value="100" />
		<string name="Caption" value="" />
		<rect name="Rect" value="460, 260, 560, 360" />
		<position name="MinSize" value="1, 1" />
		<position name="MaxSize" value="0, 0" />
		<bool name="NoClip" value="false" />
		<enum name="LeftAlign" value="upperLeft" />
		<enum name="RightAlign" value="upperLeft" />
		<enum name="TopAlign" value="upperLeft" />
		<enum name="BottomAlign" value="upperLeft" />
		<bool name="Visible" value="true" />
		<bool name="Enabled" value="true" />
		<bool name="TabStop" value="true" />
		<bool name="TabGroup" value="false" />
		<int name="TabOrder" value="1" />
		<bool name="PushButton" value="false" />
		<texture name="Image" value="" />
		<rect name="ImageRect" value="0, 0, 0, 0" />
		<texture name="PressedImage" value="" />
		<rect name="PressedImageRect" value="0, 0, 0, 0" />
		<bool name="Border" value="true" />
		<bool name="UseAlphaChannel" value="false" />
	</attributes>

</element>
This was created with the GUI Editor.








//Edit: LOL
That was too easy for me >.< I found it xD guienv->loadGUI()
Last edited by IceFire_darkalex on Mon Sep 15, 2008 2:09 pm, edited 1 time in total.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

No but it's incredibly simple to write an XML parser to get that information and construct the corresponding GUI elements anyway.

If you look at the MeshViewer tutorial there's some XML parsing in there (not sure if there's any other XML tutorials, probably some in irrXML i guess).
Image Image Image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, this can be loaded by the scene deserialization, just as 3d scenes from .irr files. Use environment->loadGUI()
IceFire_darkalex
Posts: 3
Joined: Mon Sep 01, 2008 1:08 pm

Post by IceFire_darkalex »

Thx! I found that out in that moment, too^^

But one more question about loadGUI():

If I want to make an Interface linke in WoW, where some things are on the right side of the screen, but If I want to let the user rescale the window so how can I realize thet for example a button is always 60% away from the right border

If the window is 1000 * 1000 it is on 400 from left. But what if the user rescales the window to 2000 * 2000 - if I write 400 in the XML it will now be 80% away from the right border
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Look at the meshviewer example, the Irrlicht logo is always aligned to the bottom left corner of the window even if you resize it.
Or you could read the XML you pasted ;)

Code: Select all

      <enum name="LeftAlign" value="upperLeft" />
      <enum name="RightAlign" value="upperLeft" />
      <enum name="TopAlign" value="upperLeft" />
      <enum name="BottomAlign" value="upperLeft" /> 
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply