FengGUI and jME Tutorial

Alright, code monkeys.  I have finished the FengGUI/jME tutorial.  You can find it on the Tutorials page on the wiki.

Or I’ll give you a link: http://www.jmonkeyengine.com/wiki/doku.php?id=integrating_fenggui_with_jme



You will need the newest build of FengGUI.  You can get it here: http://user.cs.tu-berlin.de/~schabby/FengGUI/2006-09-24/

You’ll need to get the Zip file, as it contains the jcore.jar file that is required by FengGUI.



I’m making this the official thread for all questions/comments/complaints about the FengGUI/jME tutorials.



I want to make sure that the tutorials are as perfect as possible, so please let me know if you find problems.



Good luck, guys!

I'll let ya know if I have troubles, I am in the middle of other input related work in my game, but once I get that done I'll try to give you some feedback. The first page of the wiki kind of confused me, I think you should probably include the download isntructions for everything you need (the fengui jar, jcore, and your utility class) and then pretty much what you have, in the future people who may want to use this won't necessarily come through this post to get there.

Awesome! Great work!



I found a small error in the wiki-entry. Unless I’m mistaken :


@Override
   protected void update(float interpolation)
   {
      input.update(interpolation);


should be something similar to:

@Override
   protected void update(float interpolation)
   {
           timer.update();
           tpf = timer.getTimePerFrame();
           input.update(tpf);

Thanks for the input guys.



I didn't put download instructions on the wiki yet because we're trying to move FengGUI to SourceForge.  Once that's up and running, I plan on updating that.



And, you're probably right about that, marqx.  I'm still quite new at jME and I only get a little bit of time each day to toy around with it.  I'll test out and make that change.



Keep 'em coming!



EDIT: I went ahead and added instructions on downloading FengGUI to the wiki start page.

You might consider using GoogleCode if you're looking for a good quality home as SF has its own issues.

I recommended Google Code, but I'm not in charge of the project  :stuck_out_tongue:

Regardless of what we went with, it would be much better than what is being used now.

just make sure you leave a note in the GUI section after you moved the project  :wink:

Update:  The project is mostly moved to SF now.  I don't think there are any builds available yet, but that should be there soon.  I'll update the wiki as soon as that happens.



On a side note, for those of you who read the tutorial already…  I'm thinking of getting rid of FengJMEInputHandler and reducing the input handling code to simple classes

highly specific to the examples.  Schabby and I discussed it and we couldn't come up with a good generic InputHandler that would work properly in all cases.  I came up with

two cases in which it fails to behave as expected.

What do you guys think?  Should it be scrapped?  Or should I leave it there as a separate tutorial on how to tie input together?

hi there



I was having a look at the tutorial and I couldn't get it to work.

Then I came to notice: you DID get rid of jcore.



So for everyone who's a noob (as I am) to jME and FengGui here, if I may,

the altered code snippits that (may not be pretty but) work:


import org.fenggui.ComboBox;
import org.fenggui.composites.Window;
import org.fenggui.event.ISelectionChangedListener;
import org.fenggui.event.SelectionChangedEvent;
import org.fenggui.layout.StaticLayout;



changed "SelectionChanged" to "SelectionChangedEvent"

protected void initGUI()
   {
      // Grab a display using an LWJGL binding
      ...
                // Create a combobox with some random values in it
                ...
                list.addItem("White");
                list.addItem("Green");
                list.addItem("Blue");
                list.addItem("Red");
               
                list.getPopupList().getToggableWidgetGroup().addSelectionChangedListener(new CBListener());
                ...
   }



changed "addListener" to "addSelectionChangedListener"
which requires an ISelectionChangedListener
so the CBListener now implements ISelectionChangedListener:


   private class CBListener implements ISelectionChangedListener
   {
       public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
         // TODO Auto-generated method stub
         if(!selectionChangedEvent.isSelected())
            return;
         String value = selectionChangedEvent.getToggableWidget().getText();
         if("White".equals(value))
            light.setDiffuse(ColorRGBA.white);
         if("Red".equals(value))
            light.setDiffuse(ColorRGBA.red);
         if("Blue".equals(value))
            light.setDiffuse(ColorRGBA.blue);
         if("Green".equals(value))
            light.setDiffuse(ColorRGBA.green);
      }
   }
}



notice:

public void signalEmitted(SignalHook<SelectionChanged> hook, SelectionChanged event)

is gone
but its "insides" are now to be found in

public void selectionChanged(SelectionChangedEvent selectionChangedEvent)



maybe you can update the code on your tutorial site?... just a suggestion  ;)

I assume you're refering to the tutorial on the wiki here…



wiki, being the keyword in that sentence :slight_smile:

yepp, the FengGUI/jME tutorial on the wiki… http://www.jmonkeyengine.com/wiki/doku.php?id=integrating_fenggui_with_jme

sorry I forgot to mention that…

Yes… there's the wiki. And it seems like you know some improvements to the code on there, to bring it up to date with FengGUI. And I see an edit button on it too…

So I'll just leave the two of you alone now… you know what I mean? :wink:

got registered… encountered code… fought hard battle… won :wink:

(hopefully no big damage done )

Well there's also a revert button so don't worry too much :wink:



Now didn't that feel good? :slight_smile:

one good deed a day, wasn't it?.. so i'm done for today…

and i've taken a small step away from noob-dom… all-in-one… incredible  :wink:



(thx for encouraging my newbie me  :smiley: )

neebie said:

and i've taken a small step away from noob-dom.. all-in-one.. incredible  ;)


At this rate you'll have to change your name soon!

Thanks for updating that tutorial neebie.  I haven't been keeping track of the changes in FengGUI for a bit now.  Glad someone was on top of it!  :smiley:

My first post!  Yay!  :smiley:



Last night I followed the tutorial and played around with FengGUI…  I like it, but has anyone had any luck getting either of the two themes it ships with to function?  After a few headaches I managed to get a



Theme theme = new Theme("path/to/theme/xml");



to work without throwing any FileNotFound or IO exceptions, but I'm not sure what to do after that...or if I'm even going about it the right way since I didn't see any methods for setting themes on the FengGUI display class.

It'd probably be better to ask the FengGUI mailing list but this seemed like a good excuse to register.  :)

Hey, first post here…

You can add a note to the mentioned wiki page about that if you want.