GUI libraries for jME

I’m making slow progress. Loading is terrible slow, I don’t know Y. The screenie shows three buttons with (quick and dirty self-made) texture background, the text is made with Java2D. The Button 2 is pressed (mouse pointer was not captured).





By Landei



Here is some code to give an impression how it works (without the background box):


        QuadButton.Style style = new QuadButton.Style();
        style.setTextColor(Color.WHITE);
        style.setTextureZoom(64);
        style.setBackgroundImage(new ImageIcon("data/button/buttonTrans200.png").getImage());
        QuadButton.Style down = style.copy();
        Image solid = new ImageIcon("data/button/buttonSolid.png").getImage();
        down.setBackgroundImage(solid);
        down.setHeight(style.getHeight() / 2);
        QuadButton.Style mouse = style.copy();
        mouse.setBackgroundImage(solid);

        for (int i = 0; i < 3; i++) {
            Button button = new QuadButton("Button " + i, new Vector2f(4, 1), style, down, mouse, null);
            button.getNode().setLocalTranslation(0, 2 - 2*i, 6);
            button.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    System.err.println("Click!");
                }
            });
            menuNode.attachChild(button.getNode());
        }
       
        BasicButton.setButtonController(getRootNode()); //my "event loop"



My buttons support 4 different states (up, mouse_over, down, inactive). Currently only flat buttons (Quads) are supported. They can use a background texture or draw the background thamselves (which looks like crap right now). You can either ask for the button state (button.isPressed() etc.), or register a ActionListener (of course, I don't use the swing eventqueue, but a simple controller).
The code is everything except clean, documented and bug free, and I need a minimal set of other components, so it makes no sense to post it now. Of course, if you really want to participate, I'd setup a google project.

so which one is better? FengGUI or BUI?



@Gerbilldrop: are you still developing GBUI library? because i tried jme-bui test and i couldnt even make it runs correctly



it generates this error:



Mar 9, 2008 11:06:31 AM class com.jmex.bui.tests.AllDialogsTest start()
SEVERE: Exception in game loop
java.lang.NullPointerException
   at com.jmex.bui.Label.layoutConfig(Label.java:368)
   at com.jmex.bui.Label.computePreferredSize(Label.java:149)
   at com.jmex.bui.BLabel.computePreferredSize(BLabel.java:141)
   at com.jmex.bui.BComponent.getPreferredSize(BComponent.java:157)
   at com.jmex.bui.layout.GroupLayout.computeChildDimens(GroupLayout.java:286)
   at com.jmex.bui.layout.GroupLayout.computeDimens(GroupLayout.java:265)
   at com.jmex.bui.layout.HGroupLayout.computePreferredSize(HGroupLayout.java:56)
   at com.jmex.bui.BContainer.computePreferredSize(BContainer.java:257)
   at com.jmex.bui.BComponent.getPreferredSize(BComponent.java:157)
   at com.jmex.bui.layout.BorderLayout.computePreferredSize(BorderLayout.java:130)
   at com.jmex.bui.BContainer.computePreferredSize(BContainer.java:257)
   at com.jmex.bui.BComponent.getPreferredSize(BComponent.java:157)
   at com.jmex.bui.layout.BorderLayout.computePreferredSize(BorderLayout.java:116)
   at com.jmex.bui.BContainer.computePreferredSize(BContainer.java:257)
   at com.jmex.bui.BComponent.getPreferredSize(BComponent.java:157)
   at com.jmex.bui.layout.GroupLayout.computeChildDimens(GroupLayout.java:286)
   at com.jmex.bui.layout.GroupLayout.computeDimens(GroupLayout.java:265)
   at com.jmex.bui.layout.VGroupLayout.layoutContainer(VGroupLayout.java:80)
   at com.jmex.bui.BContainer.layout(BContainer.java:239)
   at com.jmex.bui.BContainer.validate(BContainer.java:217)
   at com.jmex.bui.BWindow.setRootNode(BWindow.java:212)
   at com.jmex.bui.BRootNode.addWindow(BRootNode.java:94)
   at com.jmex.bui.BRootNode.addWindow(BRootNode.java:54)
   at com.jmex.bui.headlessWindows.DialogWindow.finishWindow(DialogWindow.java:87)
   at com.jmex.bui.headlessWindows.DialogWindow.createQuestionDialogWindow(DialogWindow.java:60)
   at com.jmex.bui.tests.AllDialogsTest.createWindows(AllDialogsTest.java:55)
   at com.jmex.bui.tests.BaseTest2.simpleInitGame(BaseTest2.java:58)
   at com.jme.app.BaseSimpleGame.initGame(Unknown Source)
   at com.jme.app.BaseGame.start(Unknown Source)
   at com.jmex.bui.tests.AllDialogsTest.main(AllDialogsTest.java:66)
Mar 9, 2008 11:06:31 AM com.jme.app.BaseSimpleGame cleanup
INFO: Cleaning up resources.
Mar 9, 2008 11:06:31 AM com.jme.app.BaseGame start
INFO: Application ending.


oh, sorry, i should have checked it out from svn trunk, now it works, cool! :smiley:

@gr33nl1nk: yeah, both Sfera and I do development on 'gbui'.  I forgot to compile and upload the trunk-tip jars… so yes, you were right trunk tip on svn is the correct version right now… and until I compile and upload a new set of jars.

Moving into GUI development now and am finding FengGUI too troublesome to deal with… do you still do work with GBUI? (I see the last post is dated a few months ago)

@trussell whom are you asking?



Sfera is working with a job change right now and is quite swamped for dev work.  I entered the busy season at work a few weeks ago and in another two will be out of contact for a month… I haven't had the time to spend on working on things lately as I would have wanted, but GBUI is still being developed on as there is time available.



What questions or issues do you have, etc?



timo

Just wondering if there are any tutorials available to get me started experimenting with GBUI. Feng is driving me nuts and the Fenggui forums seem to be pretty derelict.



All I need are a few examples of source code (preferably one showing it working with a SimplePassGame).



If there are any, I'd love to know  :smiley:

Tutorials are one thing that GBUI does lack and has been brought up before… It is on my list… but lists are only as good as when the things on the list get done, right?:smiley:



There are, however, under the tests directory some examples, not tutorials… there are some tutorials and explanations here http://code.google.com/p/gbui/wiki/BuiMain



What specifically with SimplePass are you looking for?  If you give me an example I can probably work one up and check it in.



timo

Well with FengGUI I was able to build a great GUI, but it conflicts with my WaterRenderPass and makes it look all funky. I’m looking for a GUI that I can plug directly into my pass manager and have it rendered on top (of course, it will have to come last).



What I have right now can be seen here. See that box in the bottom-left corner? Yeah… that’s my “GUI” if you can call it that.



Basically I want something that will go into a pass manager seamlessly (or more seamlessly than FengGUI) so I can get on with my game  }:-@

I am using old school awt swing :slight_smile:

http://img187.imageshack.us/img187/5072/testscreendr7.jpg

it’s not pretty at all at the time, but maybe later when i have time for cosmetics gg

emanuel2 said:

I am using old school awt swing :)
http://img187.imageshack.us/img187/5072/testscreendr7.jpg
it's not pretty at all at the time, but maybe later when i have time for cosmetics *gg*


I'm actually planning on using Swing as well.

Are there any disadvantages to that (other than fengGui probably allows you to make things prettier)?
Jayden Fong said:

emanuel2 said:

I am using old school awt swing :)
http://img187.imageshack.us/img187/5072/testscreendr7.jpg
it's not pretty at all at the time, but maybe later when i have time for cosmetics *gg*


I'm actually planning on using Swing as well.

Are there any disadvantages to that (other than fengGui probably allows you to make things prettier)?


About 5 times improovement on FPS - swing really sucks



Hi,



Btw,

I was trying to make FengGUI work with JME2(svn) and didnt succeed (different lwjgl version etc etc…).

Good I searched and discovered about JMEDesktop (here in this topic ^^).

To be always in sync with latest JME, the best option seems to be JMEDesktop :).

Or you create your own GUI, that u will maintain ^^…

:slight_smile: You pay your money and make your choices …



Shame Fengui hasnt yet updated to latest lwjgl libaries to match jme2.0 …

I had that problem a week (or two) ago.  Googling revealed this thread:  http://www.jmonkeyengine.com/jmeforum/index.php?action=printpage;topic=7848.0



Basically you can update FengGUI such that it uses LWJGL v2.0 or use Core-Dump's updated version, from the Stardust demo.

Right, FengGui doesn’t come with the latest lwjgl and it won’t until after it’s next major release (See here). But it’s really easy change in your local copy, as it only requires changing about 5 import statements.



Yep, pretty easy indeed:

1 - download lwjgl-2.0rc1.zip and put it at FengGUI

2 - update build.xml from FengGUI to new lwjgl

3 - at eclipse, remove old lwjgl-1.1.2 jar and add from 2.0rc1 two jars: lwjgl.jar and lwjgl_util.jar

4 - update where complaints about import org.lwjgl.opengl.glu.GLU to org.lwjgl.util.glu.GLU



Ok, it now compiles and runs without errors.

==edit-below==

Then when I try to run the tutorial FengJMEInputHandler + FengJME, I was getting just a black and functional screen, and the only way to see FengGUI is to comment the JME drawing at render() method. I will look later on it…

  1. Make sure you have the latest FengGui from SVN
  2. Make sure to se/reset the default texure state before calling the fenggui display method. You can find examples of this in the forums here, and in the wiki.



Yep,



1 - yesterday FengGUI checkout :slight_smile:



2 - mmm… I went here:

http://www.jmonkeyengine.com/wiki/doku.php?id=fenggui_jme_appl_using_standardgame



Tho it is all implemented towards JME1, so I took some time to guess all new substitutions. Hardest one, I found that AlphaState is now BlendState in JME2 ^^. These adjustments could go to the wiki (a new entry w/o overwriting existing JME1 one).



So, it run perfectly on my JME2(svn) + FengGUI(svn) + lwjgl2.0rc1.

To both examples (screenshots) there!



3 - yey!


yes the wiki and jme1 <-> jme2 is a bit of a problem.

either we slowly migrate the wiki entries to jme 2 or we create duplicate pages with jme1 and jme2 versions.

At the moment some users still stick to jme1, as it is the 'official' release, so i guess copy/paste is the better solution, later the jme1 version can just be deleted.



btw. if you have any additional comments to the fenggui example in the wiki (or any wiki entry ) don't hesitate to update the wiki.