3D HUD

hi

I’ve started to write a (so far simple) widget set for a HUD. Of course it is far far away from complete. But I think, it is a base to be expanded.

Watch package “org.xith3d.ui.hud” on CVS and the FullscreenRenderTest. All I have implemented so far is used there (an fps counter).

I hope, you like it and we can work on it together.

Qudus

I am interested in this also, what exactly are you trying to do. We have the xith UI system and the foregorud node. How does your idea differ??

AFAIK the xith UI system utilizes Swing to render the GUI. In many posts I’ve read, that poeple are interested in a pure Xith GUI. My one is pure Xith (or will be, when it’s ready)!

My idea doesn’t differ from the Foreground node, but uses it (and parallel projection).

I’m creating a widget base, that can be used to build you own widget(s). As far as I have time to, I’ll additionally create the most common widgets.

Everything about the functioning is explained directly in the classes. Watch this: https://xith-tk.dev.java.net/source/browse/xith-tk/src/org/xith3d/ui/hud/

I made a simple HUD demostration test. You can find it on CVS (org.xith3d.test.HUD3DTest).

It won’t compile. The two offending lines are below :


keyboard = inputAdapter.registerKeyboard(new AWTKeyboard(canvas3D.getComponent()));
mouse = inputAdapter.registerMouse(new AWTMouse(canvas3D.getComponent()));

It says InputAdapter doesn’t contain the registerKeyboard nor the registerMouse methods.

[quote="<MagicSpark.org [ BlueSky ]>,post:5,topic:27660"]
It won’t compile. The two offending lines are below :


keyboard = inputAdapter.registerKeyboard(new AWTKeyboard(canvas3D.getComponent()));
mouse = inputAdapter.registerMouse(new AWTMouse(canvas3D.getComponent()));

It says InputAdapter doesn’t contain the registerKeyboard nor the registerMouse methods.
[/quote]
Recheckout your CVS. It should be solved. You probably checked yout while I was checking in. And this is not used in that context anymore. I included HIAL into my RenderLoop class.

Recheckout your CVS. It should be solved. You probably checked yout while I was checking in. And this is not used in that context anymore. I included HIAL into my RenderLoop class.
[/quote]
Hmm… in the while I added the methods myself ;D ;D
OK about the stone image is it normal that when you click on it it scales and translate ?
About your @author tag : please replace “ö” by “oe” (or is it “ü” ? in which case you would put “ue”). These accentued characters are a pain (passing from UTF-8 to ISO-8859-1 or inverse makes you loose some.

[quote="<MagicSpark.org [ BlueSky ]>,post:7,topic:27660"]
OK about the stone image is it normal that when you click on it it scales and translate ?
[/quote]
In the moment I’m implementing HUD picking (without the use of 3D-picking) . This is my test reaction of a picking. I checked in my changes for you to have a functional version. This resizing thing is not part of the Widget class, but is in the HUD3DTest class. It will disappear or being replaced by some other test reaction, when I have finished this step.

[quote="<MagicSpark.org [ BlueSky ]>,post:7,topic:27660"]
About your @author tag : please replace “ö” by “oe” (or is it “ü” ? in which case you would put “ue”). These accentued characters are a pain (passing from UTF-8 to ISO-8859-1 or inverse makes you loose some.
[/quote]
Can’t I use ö for an ö?

No, I can’t. I’ve changed every occurance and it will come with my next checkin.

In the moment I’m implementing HUD picking (without the use of 3D-picking) . This is my test reaction of a picking. I checked in my changes for you to have a functional version. This resizing thing is not part of the Widget class, but is in the HUD3DTest class. It will disappear or being replaced by some other test reaction, when I have finished this step.
[/quote]
OK.

Can’t I use ö for an ö?
[/quote]
Hmm no idea. Anyway I rarely use an HTML browser for reading javadocs and ö is just ugly in plain text.
ö -> oe and ü -> ue are just the standard way when you don’t have accents

OK. I hope you didn’t do that manually ? Just a Ctrl-H & Replace in Eclipse and it’s done !

[quote="<MagicSpark.org [ BlueSky ]>,post:11,topic:27660"]
OK. I hope you didn’t do that manually ? Just a Ctrl-H & Replace in Eclipse and it’s done !
[/quote]
Actually I did it by hand. I’m at daggers drawn with the Eclipse search functionality. But I used file search to find all occurences. So it wasn’t too hard. :wink:

Sooo, I’ve implemented the very most basic things for the HUD.

Current features are:

  • The HUD node as the main container can have it’s own coordinate system and (0,0) is uppler-left
  • Interfaces and abstract classes to implement more Widgets
  • abstract classes to make implementing more Widgets easier
  • ImageWidget to display an image on your HUD (textured quad)
  • TextWidget to display text on your HUD (still buggy)
  • FPSCounter to display the FPS count on your HUD
  • z-index system to display several Widgets over each others
  • Widget-picking without the use of 3D picking
  • move and resize Widgets

I hope this HUD system will be accepted by the community and can serve as a base for more Widgets and features. If anybody needs a Widget, feel free to add it to the package and make use of the abstract base classes and interfaces.

Qudus

Going on holiday…hope to come back with my game demo and some additions to this package.

Really, really nice I just can’t wait implementing some Button widgets…

How about adopting Swing naming conventions for widgets ? TextWidget would become Label… I think it’s easier when you come from Swing (when you learn Java you usually learn a bit of Swing in the meanwhile)

[quote="<MagicSpark.org [ BlueSky ]>,post:15,topic:27660"]
Really, really nice I just can’t wait implementing some Button widgets…
[/quote]
I will love to see them.

[quote="<MagicSpark.org [ BlueSky ]>,post:15,topic:27660"]
How about adopting Swing naming conventions for widgets ? TextWidget would become Label… I think it’s easier when you come from Swing (when you learn Java you usually learn a bit of Swing in the meanwhile)
[/quote]
I totally agree and renamed TextWidget to Label.

I will love to see them.
[/quote]
For now I do ImageButtons, containing three Image widgets (see the ImageButton class).

But I still have to think about how events are dispatched.

I totally agree and renamed TextWidget to Label.
[/quote]
Also, having the “Widget” suffix is fine for containers but not for regular widgets (Labels, Images, Buttons, CheckLists, etc…)

EDIT : News : I wonder how we could handle event. for now a MouseDevice is passed to the constructor of ImageButton but it’s not really clean… And how can I access the “HUD” object from a Widget ? I need to do picking inside the ImageButton class.

[quote="<MagicSpark.org [ BlueSky ]>,post:17,topic:27660"]
EDIT : News : I wonder how we could handle event. for now a MouseDevice is passed to the constructor of ImageButton but it’s not really clean… And how can I access the “HUD” object from a Widget ? I need to do picking inside the ImageButton class.
[/quote]
Everytime you click the mouse the main mouse listener in the RenderLoop calls the pick mehtod on the HUD. This method dispatches this event to all Widgets. just overrider the pick method of RectangularWidget with a super call. There you can get the information you need.

About a hover effect… I will implement a method on the HUD class which is called by the mouseMoved event and that works just like the pick method. Then you will be able to regisster a mouse over event.

I for one would enjoy a cheap demo off the xith.org site, if its not a pain. Right now I am locked into an older version of xith until I finish this phase. Several UI alternatives have been discussed in the past, having one out there and avaqilble for play might help get addional momentum for this version. ::slight_smile:

I’ve implemented the Listener thing and some other methods. recheckout your CVS. Please note, that I’ve used other images for the Button, because I didn’t have yours. Please put your button test images into the demo folder of xith-tk and check them to CVS. The demo folder is registered to the TextureLoader, so can pass the image names to the Button constructor without the path.

[quote="<MagicSpark.org [ BlueSky ]>,post:17,topic:27660"]
And how can I access the “HUD” object from a Widget ? I need to do picking inside the ImageButton class.
[/quote]
Call the getContainer() method. This will return the Widget’s container which is so far actually always the HUD. Just cast the result.

Qudus