New GUI library available

I applogize for being out of touch for so long. I once again have changed jobs. Anyhow, here’s a cleaned up version of what I have currently working. There’s still a lot to do, and I’m sure plenty of bugs. Please post any bugs, and I’ll get to them as quick as I can.



Here are the files:

http://www.resonus.net/tiki-list_file_gallery.php?galleryId=1

You’ll find a CVS Diff, a Zip of the source (with required images), and the Java Docs.



Here are some screenshots:

http://www.resonus.net/tiki-browse_gallery.php?galleryId=1



Notes

    Review the TODO list within the project workspace.
    This library extention requires Java 5.0.
    There is deprecated information in the xml file and the corresponding code. I'll be removing that soon.
    I really think that the GameState System should be modified to allow for more than one state active at a time. This would allow for a gui state over a 3D state.
    [/list:u]
    What's Working
    (This is all using the default Text object... no custom text yet)
    XML Look and Feel Scheme Loading
    Movable FrameWindows - Textured
    Buttons - Textured & Drawn
    EditBoxes - Textured & Drawn
    Combo - Combination EditBoxes and Buttons
    AbsoluteLayoutManager
    [/list:u]
    What Still Needs Doing
    Tutorial on how to create a new component - ProgressBar
    Scroll Bars & Scrollable Regions
    Drawable FrameWindows
    Resizing
    GridBagLayoutManager
    Text Objects - Dynamic Texture, Multi-Quad (Like the current ui.UIText), and expanded Display List (Like the current scene.Text).
    Non-Editable EditBox - TextBox.. or StaticTextBox
    [/list:u]
    What You Can Make From What's There

    From the example of the current components it should be straitforward to create these:
    DropDown Menu Box - Just a Non-Editable EditBox in a Combo
    ProgressBar - Basic UIWindow derivation
    Tabs - Buttons with cullable sets of components
    CheckBox / RadioButton - Just a UIButton with slight difference in state switching
    Basic Static Image - I haven't tried it actually, but a stand alone instance of a UIWindow should work just fine.
    [/list:u]
    Please try this out and tell me what you think.

speachles…



I’l port my progress bar to it soonish (im kinda busy atm with physics).



But is the 1.5 really needed? It seems you only use generics…



Otherwise…COOL!



DP :smiley:

Check out the files area listed above for two sets of patches that give new functionality:



0.11 - Non-Editable EditBoxes (Static Boxes) and Non-Editable Combos (Drop Down Menus).



0.12 - Fixed XML so that features are under texture sets, thus allowing more than one texture set per laf scheme. Also added a new component UIImagePanel which is a replacement for UIBillboard. And finally an updated Test State for showing off this new functionality.



I don’t think I was clear here, you’ll want both files.



Also

Please go here if you find bugs:



http://www.resonus.net/tiki-view_tracker.php?trackerId=1



This tracker will be updated by me as I find stuff, and this way you can verify that they aren’t already found and being worked. Thanks.

This is great, but I’m getting errors from the zip file. Some data in the file may be damaged is what it’s saying. Bad CRC’s. That’s from the main source file btw.

I echo DP’s sentiments about Java 1.5 being required. Currently OS X 10.3, and even Tiger (10.4) don’t have it yet, in addition to the millions of Windows users who don’t upgrade their version of Java.



Otherwise, awesome work!

Try downloading it again, I’m having problems with the site right now. My web host is looking into it.

Got it now. Thanks.

Looks great Guurk. I have yet to download it and try it, but the screenshots show a lot of promise.



I particularly like the idea of designing the GUI’s look and feel in a scriptable fashion to remove the need to compile GUI changes. What’s the chances of also defining the widget elements in this XML? Position, size, etc.



Have you taken a look at samskivert’s BUI stuff? Perhaps, you guys can bounce ideas off one another.



keep it up!

Doing xml based gui initialization would be straitforward. The use might be a little dubious when I think of how dynamic guis seem to be within a game. Could you maybe give me an example of how you’d use it?



One other question I have is about clipping. Could you maybe give some pointers about how I might set up scrollable subnodes that are clipped? I keep thinking there must be an easy way to do it and figure you’ve gotta have something in that treasure trove you call a mind.

Due to Popular Demand - Java 1.4 Compatability



You can download the latest version of NUI. Version 0.12.



It is now compatible with JDK 1.4… no dependancy on 5.0 anymore (although all the 5.0 code is just commented out and replaced with 1.4 equivalent).



Enjoy!



http://www.resonus.net/tiki-list_file_gallery.php?galleryId=1

The use might be a little dubious when I think of how dynamic guis seem to be within a game. Could you maybe give me an example of how you'd use it?


I was thinking more of defining initial set-up of the gui on startup. For instance:


<panel name="Chat" x="0" y="0">
    <texture name="blah.bmp"/>
    <panel name="Chat Child Panel" x="1" y="1"/>
</panel>



NOTE: obviously just a simplistic illustration.

But something that would allow you to define the components, appearance, heirarchy and position of the windows at runtime rather than compile time.

One other question I have is about clipping. Could you maybe give some pointers about how I might set up scrollable subnodes that are clipped? I keep thinking there must be an easy way to do it and figure you've gotta have something in that treasure trove you call a mind.


I would keep it simple as possible. Something like:

if(panel.contains(scrollable)) {
   draw(scrollable);
}



where contains is a method that simply determines if the scrollables position is within the boundaries of the panel that owns it. So as things scroll outside of the panels borders, you stop drawing them. If you are using the LWJGLRenderer to draw and as such are relying on the scenegraph for rendering, you can do:

if(panel.contains(scrollable)) {
   scrollable.setForceView();
} else {
   scrollable.setForceCull();
}



Of course, again as usual, I'm simplifying a lot.

Thanks Mojo… your thoughts will help with scrolling I’m sure. I’ll probably get to that next week.



Here’s what I’m implementing right now:



The xml would look like the following for the exact same test state that’s hard coded in the current test.



The interesting part of this is two fold.



One: allowing the user to then gain access to whatever components are available by name.



Two: doing the method linking so that you can define methods to get the events on components that are configured via xml.



I only have about an hour of time available right now until Monday… we’ll see how much I can get done :P.



I’m working from the premise that I’m extending my StandardUIGameState into a XMLUIGameState. Then you extend from that, pass in the state.xml filename to the super() constructor and then only implement the method callbacks.



<?xml version="1.0" encoding="UTF-8"?>
<state>
   <laffile>/jmetest/nui/testlaf.xml</laffile>
   <defaultscheme>winxpolive</defaultscheme>
   <defaultlayoutmanager>AbsoluteLayoutManager</defaultlayoutmanager>
   <components>
      <component uitype="UIImagePanel">
         <textureset>monkey</textureset>
         <type>monkeypanel</type>
         <locx>1</locx>
         <locy>1</locy>
         <sizew>23</sizew>
         <sizeh>23</sizeh>
      </component>
      <component uitype="UIFrameWindow">
         <text>Test Frame Window</text>
         <textureset>default</textureset>
         <type>mainwindow</type>
         <locx>10</locx>
         <locy>10</locy>
         <sizew>400</sizew>
         <sizeh>400</sizeh>
         <components>
            <component uitype="UIButton">
               <text>Textured Button</text>
               <textureset>default</textureset>
               <type>standard</type>
               <locx>10</locx>
               <locy>50</locy>
               <sizew>200</sizew>
               <sizeh>40</sizeh>
               <methodlink name="onClick">buttonClick</methodlink>
            </component>
            <component uitype="UIEditBox" editable="false">
               <text>Textured Edit Box</text>
               <textureset>default</textureset>
               <type>standard</type>
               <locx>10</locx>
               <locy>165</locy>
               <sizew>300</sizew>
               <sizeh>20</sizeh>
            </component>
            <component uitype="UIButton">
               <text>Drawn Button</text>
               <textureset>default</textureset>
               <locx>10</locx>
               <locy>200</locy>
               <sizew>160</sizew>
               <sizeh>40</sizeh>
               <methodlink name="onClick">buttonClick</methodlink>
            </component>
            <component uitype="UIEditBox">
               <text>Drawn Edit Box</text>
               <textureset>default</textureset>
               <locx>10</locx>
               <locy>250</locy>
               <sizew>300</sizew>
               <sizeh>20</sizeh>
            </component>
            <component uitype="UICombo" editable="false">
               <text>Combo Drop Down</text>
               <textureset>default</textureset>
               <type>standard</type>
               <locx>10</locx>
               <locy>300</locy>
               <sizew>300</sizew>
               <sizeh>20</sizeh>
               <items>
                  <item>An Item</item>
                  <item>Another Item</item>
                  <item>Still More</item>
               </items>
            </component>
         </components>
      </component>
   </components>

</state>

"guurk" wrote:
Due to Popular Demand - Java 1.4 Compatability

You can download the latest version of NUI. Version 0.12.

It is now compatible with JDK 1.4... no dependancy on 5.0 anymore (although all the 5.0 code is just commented out and replaced with 1.4 equivalent).

Enjoy!

http://www.resonus.net/tiki-list_file_gallery.php?galleryId=1

You're still using System.nanoTime() in this source.

Nano nano.

Yes I am… what you don’t have a nano timer in 1.4 :D… sorry about that, I just set up Eclipse to use 1.4 compiler compliance… I’m still using 5.0 libraries underneath. I don’t even bother with 1.4 for the most part.



I’ll fix. Sorry.

OK, Fixed. The file that’s there now does not have the nano stuff. I hope there aren’t any more problems for you.



I’m gone this weekend so remember that the file gallery on my site is open to the public, you can upload fixes if I’m not around. Thanks.

Awesome! Thanks for making it 1.4 compatable! :slight_smile:

http://www.resonus.net/tiki-list_file_gallery.php?galleryId=1



Version 0.13



I’ve now released the ability to set up your initial gui state via xml. This new test example produces the exact same gui as the previous hard coded example which is still in the test area.



I’ve had to add a little bit of new functionality to allow the dynamic run-time registration for events. This needs to be somewhat expanded but I figured I’d get the stuff out there for test and feedback before finalizing.



One cool feature is that if you extend from UIWindow or a subcomponent and keep the exisiting constructor interface you can then put your new class within the xml for configuration.



So, please. Try this out and give me input!



Either post here in this forum or here in my NUI Bug/Feature Tracker



Java 5.0



As a side note. When are we going to support Java 5.0. I’m really missing the features I had to comment out. And I’d like to be using Annotations for some stuff too.



If we are waiting for Mac then I don’t understand, it is supported: http://www.apple.com/support/downloads/java2se50release1.html

Yes this was actually just released a few days ago, but it’s just the runtime environment. The SDK hasn’t been released yet…

according to the apple site, it appears 1.5 sdk is available for Mac OSX… but only for Tiger. (see FAQ #1: http://developer.apple.com/java/faq/) And according to the above site, it’s only ever going to be on Tiger or above. :frowning:

Edit: Wait… I might be wrong… downloading what might be it now (thought it was just the RE). Will post back as soon as it’s installed.