Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  3D HUD  (Read 6850 times)
0 Members and 1 Guest are viewing this topic.
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Posted 2006-06-18 02:09:48 »

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
Offline hawkwind

Junior Member




Java games rock!


« Reply #1 - Posted 2006-06-18 02:59:27 »

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??
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #2 - Posted 2006-06-18 13:22:22 »

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 am interested in this also, what exactly are you trying to do.

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/
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #3 - Posted 2006-06-18 17:48:13 »

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

Senior Member




Everything's possible, but not everything's fun...


« Reply #4 - Posted 2006-06-19 16:31:35 »

It won't compile. The two offending lines are below :
1  
2  
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.

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #5 - Posted 2006-06-19 16:47:28 »

It won't compile. The two offending lines are below :
1  
2  
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.

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.
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #6 - Posted 2006-06-19 17:12:46 »

It won't compile. The two offending lines are below :
1  
2  
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.

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.
Hmm.... in the while I added the methods myself  Grin Grin
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.

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #7 - Posted 2006-06-19 17:18:28 »

OK about the stone image is it normal that when you click on it it scales and translate ?

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.

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.

Can't I use ö for an ö?
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #8 - Posted 2006-06-19 17:42:30 »

Can't I use ö for an ö?

No, I can't. I've changed every occurance and it will come with my next checkin.
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #9 - Posted 2006-06-19 17:50:37 »

OK about the stone image is it normal that when you click on it it scales and translate ?

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.
OK.
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.

Can't I use ö for an ö?
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

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #10 - Posted 2006-06-19 17:57:48 »

Can't I use ö for an ö?

No, I can't. I've changed every occurance and it will come with my next checkin.
OK. I hope you didn't do that manually ? Just a Ctrl-H & Replace in Eclipse and it's done !

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #11 - Posted 2006-06-19 18:11:03 »

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

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
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #12 - Posted 2006-06-19 21:23:48 »

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
Offline hawkwind

Junior Member




Java games rock!


« Reply #13 - Posted 2006-06-20 03:03:12 »

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

Senior Member




Everything's possible, but not everything's fun...


« Reply #14 - Posted 2006-06-20 11:18:17 »

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
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)

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #15 - Posted 2006-06-21 00:51:23 »

Really, really nice I just can't wait implementing some Button widgets...

I will love to see them.

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)

I totally agree and renamed TextWidget to Label.
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #16 - Posted 2006-06-21 17:57:34 »

Really, really nice I just can't wait implementing some Button widgets...

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

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

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)

I totally agree and renamed TextWidget to Label.
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.

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #17 - Posted 2006-06-21 22:02:20 »

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.

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.
Offline hawkwind

Junior Member




Java games rock!


« Reply #18 - Posted 2006-06-21 23:23:06 »

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. Roll Eyes
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #19 - Posted 2006-06-21 23:26:16 »

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.

And how can I access the "HUD" object from a Widget ? I need to do picking inside the ImageButton class.

Call the getContainer() method. This will return the Widget's container which is so far actually always the HUD. Just cast the result.

Qudus
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #20 - Posted 2006-06-22 13:08:46 »

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.

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.
OK.

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.
OK.

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. Roll Eyes
Hmm please wait 30 minutes I added that to my TODO list  Grin I'm studying the JWS mechanism used by William Denniss on the site.

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #21 - Posted 2006-06-22 13:45:24 »

Hmm Qudus the button widget does not work really good, cause the image change is called directly from the AWT Event thread (may cause threadind problems : Xith doesn't support multi-threading). I think I can use ScheduledOperations to change image, but how to implement that, HUD is not based on an ExtRenderLoop ?

I'll investigate please don't do that for me (hey it's not fun if you just code everything  Grin  Cool )

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #22 - Posted 2006-06-22 14:07:05 »

Woohooo ! Now buttons work perfectly with scheduled operations ! Qudus, check out your tk.

Now I'll just hack some listener thing so you can actually catch and handle button events.

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #23 - Posted 2006-06-22 15:18:38 »

Hmm Qudus the button widget does not work really good, cause the image change is called directly from the AWT Event thread (may cause threadind problems : Xith doesn't support multi-threading). I think I can use ScheduledOperations to change image, but how to implement that, HUD is not based on an ExtRenderLoop ?

hey, good point. And well done. I only changed it a bit, so that not an ExtRenderLoop is expected but an OperationScheduler which is an interface implemented by ExtRenderLoop. I think, this is a little cleaner and I wrote this interface for such a purpose.

I'll investigate please don't do that for me (hey it's not fun if you just code everything  Grin  Cool )

Sorry. I shouldn't do that.

Woohooo ! Now buttons work perfectly with scheduled operations ! Qudus, check out your tk.

Really cool. I added some contructors to the ImageButton class and completed the javadoc for them.

Now I'll just hack some listener thing so you can actually catch and handle button events.

Can't wait to see them. Should be senseful to lean on Swing in that point, too, right?
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #24 - Posted 2006-06-22 15:31:34 »

Hmm Qudus the button widget does not work really good, cause the image change is called directly from the AWT Event thread (may cause threadind problems : Xith doesn't support multi-threading). I think I can use ScheduledOperations to change image, but how to implement that, HUD is not based on an ExtRenderLoop ?

hey, good point. And well done. I only changed it a bit, so that not an ExtRenderLoop is expected but an OperationScheduler which is an interface implemented by ExtRenderLoop. I think, this is a little cleaner and I wrote this interface for such a purpose.
Hmmyeah you're absolutely right.

I'll investigate please don't do that for me (hey it's not fun if you just code everything  Grin  Cool )

Sorry. I shouldn't do that.
Oh at least it's done ^^ That's all whats important.

Woohooo ! Now buttons work perfectly with scheduled operations ! Qudus, check out your tk.

Really cool. I added some contructors to the ImageButton class and completed the javadoc for them.
Thanks.
Now I'll just hack some listener thing so you can actually catch and handle button events.

Can't wait to see them. Should be senseful to lean on Swing in that point, too, right?
Yes indeed.

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #25 - Posted 2006-06-23 15:34:08 »

Text buttons now work. But there's a slight problems with mouse events : they are dispatched twice. (See the "Basic button" to which one "." only should be added per event : as you click there are two dots added).

And also the picking doesn't work properly anymore when you resize the window.

Ans last see the commented line : when I add a background between a TextButton it hides the button background and shows the text (uncomment the line to see the effect).

The ActionListener is now working perfectly (apart from double events).

So the Exit button now really exits.

Here's a screenshot of what has been done.

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #26 - Posted 2006-06-23 15:38:22 »

I think I got the idea about this problem with ImageButtons and the Background.  Grin

The Image is never added to an instance of WidgetContainer. Maybe the problem disappeares when you implement an inner class to the ImageButton class which implements WidgetContainer. Link the getContainer mehtod of this class with the Container of the ImageButton. Then add the Image to this container. Only when you add a Widget to a Container, the coordinates are correctly calculated. I don't know if this solves the problem and i'm not at home so I cannot code it. But I tjhink it's worth a try.

And don't directly add the Image to the ImageButton's container, cause this would disturb the children count of the HUD.

Qudus
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #27 - Posted 2006-06-23 15:41:59 »

Text buttons now work. But there's a slight problems with mouse events : they are dispatched twice. (See the "Basic button" to which one "." only should be added per event : as you click there are two dots added).

And also the picking doesn't work properly anymore when you resize the window.

Ans last see the commented line : when I add a background between a TextButton it hides the button background and shows the text (uncomment the line to see the effect).

The ActionListener is now working perfectly (apart from double events).

So the Exit button now really exits.

Did you recently check out your CVS today? I worked on this problem just three hours ago.

Here's a screenshot of what has been done.

Where???
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #28 - Posted 2006-06-23 15:53:26 »

Sorry I missed the screenshot : I wanted to send this message yesterday but the forums were down when I wanted so I saved my message to a text file and forgot to attach the image today ^^

Here it is.

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #29 - Posted 2006-06-24 05:17:37 »

Works!!!

I got the problem concerning the ImageButtons. Finally the solution was easier than I expected.

Amos, please don't put this constructor with the hardcoded image names to the TextButton. I don't think, we should put hardcoded filenames to any class in the tk.

What do you say about merging ImageButton and TextButton to one class? We would put all constructors of both classes together and had one class being able to render a button with or without text and with or without images.
Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (25 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (13 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (44 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!