GUI with XML

Started by Kokoni, August 04, 2005, 12:35:02

Previous topic - Next topic

Kokoni

Hi all,

I have a question concerning the Graphics User Interface : do you know a library which can permit to create an opengl GUI controlled by XML ?
With GUI library, I mean an API which creates label, textfield ... usual window components, describe in an xml file.

It exists in C++ (I've seen one in gamedev forum) but I don't know in java.

Thanks in advance for your answers/


Kokoni

numberR

i'm planning to make one for my game, and here is a list of things that i'm referencing which utilize xml to build gui with java:

http://java-source.net/open-source/xml-user-interface-toolkits
http://gui4j.org

those do not use OpenGL, so that would be the thing that i need to think how i should design. i'm thinking how i should handle event on gui component with xml. but don't expect fot my stuff though. it would take a long time since i'm kinda busy recently.

good luck.

tomb

I did somthing like what you describe and it is available here:
http://home.halden.net/tombr/gui/gui.html

A snippet from the xml file I used in one of my guis:
<!-- Main Menu Frame -->
<XPFrame name="mainFrame" title="Main Menu" bounds="20 20 200 171">
<XPBorder type="SOLID_COLOR" bgcolor="ECE9D8" insets="5 5 5 5">

<!-- Vertical list of components -->
<Component>
<GridLayout vgap="4" xweights="-1" yweights="22 22 22 22 22"/>
<XPButton name="mainCreate" text="Create"/>
<XPButton name="mainJoin"   text="Join"/>
<XPButton name="mainSetup"  text="Setup"/>
<XPButton name="mainDebug"  text="Debug"/>
<XPButton name="mainExit"   text="Exit"/>
</Component>

</XPBorder>

<FocusTraversalList>
<item>mainCreate</item>
<item>mainJoin</item>
<item>mainSetup</item>
<item>mainExit</item>
</FocusTraversalList>
</XPFrame>



<!-- Setup dialog -->
<XPFrame name="setupFrame" title="Setup" bounds="20 200 255 268">

<!-- 15 pixel border inside frame -->
<XPBorder type="SOLID_COLOR" bgcolor="ECE9D8" insets="7 6 7 6">

<Component>
<GridLayout vgap="6" xweights="-1" yweights="-1 22"/>

<XPTabPanel>

<!-- Player Options -->
<TabText>Player</TabText>
<Component><GridLayout hgap="4" columns="2" rows="1"/>

<Component><GridLayout vgap="8" xweights="35 -1" yweights="19 21 16 19 19 19 19"/>
<XPTextLabel text="Name:"/>
<XPBorder insets="2 2 2 2"><XPTextField text="JohnDoe" name="joinName"/></XPBorder>
<XPTextLabel text="Model:"/>
<XPComboBox selectedIndex="0" visibleLines="4" name="setupModel">
<item>Gorre</item>
<item>Visor</item>
<!-- item>Anarki</item -->
<item>Hunter</item>
<item>Harpy</item>
</XPComboBox>
</Component>

<XPViewport name="viewportModel"/>
</Component>

<!-- Video and Video Options -->
<TabText>Audio and Video</TabText>

<Component><GridLayout hgap="4" vgap="4" xweights="65 -1" yweights="21 21 19 19 19 19"/>
<XPTextLabel text="Resolution"/>
<XPComboBox selectedIndex="0" visibleLines="4" name="setupResolution">
<item>640 x 480</item>
<item>800 x 600</item>
<item>1024 x 768</item>
<item>1280 x 1024</item>
</XPComboBox>

<XPTextLabel text="Color Depth"/>
<XPComboBox selectedIndex="2" visibleLines="3" name="setupColorDepth">
<item>16-bit Color</item>
<item>24-bit Color</item>
<item>32-bit Color</item>
</XPComboBox>

<Component/><XPButton name="setupFullscreen"  text="Fullscreen"            type="CHECKBOX" selected="false"/>
<Component/><XPButton name="setupTrilinear"   text="Trilinear filtering"   type="CHECKBOX" selected="true"/>
<Component/><XPButton name="setupVSync" 	  text="Wait for vsync" 	   type="CHECKBOX" selected="false"/>
<Component/><XPButton name="setupSound" 	  text="Sound" 				   type="CHECKBOX" selected="true"/>

<FocusTraversalList>
<item>setupTrilinear</item>
<item>setupVbo</item>
<item>setupSound</item>
</FocusTraversalList>
</Component>

<!-- Controlls Options -->
<TabText>Controlls</TabText>
<Component><GridLayout vgap="4" xweights="-1" yweights="19 -1"/>
<XPButton name="setupInvertMouse" text="Invert mouse" type="CHECKBOX" selected="false"/>

<XPBorder insets="5 5 5 5" type="DIM">
<Component name="keyContainer"><GridLayout hgap="4" xweights="-1 -1 -1" yweights="17 17 17 17 17 17 17 17 17 17 -1"/>
<XPTextLabel text="Action"/> 		<XPTextLabel text="Key 1"/> 		<XPTextLabel text="Key 2"/>
<XPTextLabel text="Forwards"/>		<XPKeyInput name="key1Forwards"/>	<XPKeyInput name="key2Forwards"/>
<XPTextLabel text="Backward"/>		<XPKeyInput name="key1Backwards"/>	<XPKeyInput name="key2Backwards"/>
<XPTextLabel text="Strafe Left"/>	<XPKeyInput name="key1StrafeLeft"/>	<XPKeyInput name="key2StrafeLeft"/>
<XPTextLabel text="Strafe Right"/>	<XPKeyInput name="key1StrafeRight"/><XPKeyInput name="key2StrafeRight"/>
<XPTextLabel text="Jump"/>			<XPKeyInput name="key1Jump"/>		<XPKeyInput name="key2Jump"/>
<XPTextLabel text="Talk"/>			<XPKeyInput name="key1Talk"/>		<XPKeyInput name="key2Talk"/>
<XPTextLabel text="Plasma Gun"/>	<XPKeyInput name="key1Plasma"/>	    <XPKeyInput name="key2Plasma"/>
<XPTextLabel text="Rocket Launcher"/><XPKeyInput name="key1Rocketl"/>	<XPKeyInput name="key2Rocketl"/>
<XPTextLabel text="Railgun"/>		<XPKeyInput name="key1Railgun"/>	<XPKeyInput name="key2Railgun"/>

<FocusTraversalList>
<item>key1Forwards</item>
<item>key2Forwards</item>
<item>key1Backwards</item>
<item>key2Backwards</item>
<item>key1StrafeLeft</item>
<item>key2StrafeLeft</item>
<item>key1StrafeRight</item>
<item>key2StrafeRight</item>
<item>key1Jump</item>
<item>key2Jump</item>
<item>key1Talk</item>
<item>key2Talk</item>
</FocusTraversalList>
</Component>
</XPBorder>

</Component>


<!-- Color Options -->
<TabText>Color</TabText>
<Component><GridLayout xweights="65 -1" yweights="16 16 8 16 16 8 16 16"/>
<XPTextLabel text="Gamma:"/>     <XPScrollbar name="colorGamma"      orientation="horizontal" value="50" extent="15" min="0" max="115"/>
<Component/><XPTextLabel name="gammaValue" halign="CENTER"/>
<Component/><Component/>
<XPTextLabel text="Brightness:"/><XPScrollbar name="colorBrightness" orientation="horizontal" value="50" extent="15" min="0" max="115"/>
<Component/><XPTextLabel name="brightnessValue" halign="CENTER"/>
<Component/><Component/>
<XPTextLabel text="Contrast:"/>  <XPScrollbar name="colorContrast"   orientation="horizontal" value="50" extent="15" min="0" max="115"/>
<Component/><XPTextLabel name="contrastValue" halign="CENTER"/>
</Component>

</XPTabPanel>

<!-- button list on the right -->
<Component><GridLayout hgap="4" xweights="-1 75 75" yweights="-1"/>
<Component/>
<XPButton name="setupClose" text="Close"/> 
<XPButton name="setupApply" text="Apply"/>
</Component>
</Component>
</XPBorder>

</XPFrame>

Kokoni

Many thanks for the links!!

I will work on it.



Kokoni.