Hello Guest

Clicking required to start Applet

  • 4 Replies
  • 10290 Views
Clicking required to start Applet
« on: February 09, 2009, 18:28:15 »
After upgrading from JME 1 to JME 2 (also LWJGL 1 to 2) my applet version of my game requires a single mouse click to proceed from the 'Switching Applet' part of loading into the actual game.  There were very few changes other than the upgrade and I was wondering if anyone else has seen this issue.

This is an interesting problem to search for so I decided to just go through all the topics with applet in their titles on both the JME and the LWJGL forums.  There wasn't very many, but I did find one.

http://www.jmonkeyengine.com/jmeforum/index.php?topic=9906.msg75755#msg75755

It only mentions that the problem happens and offers no solution to it.

Some possibly related facts.

1.  The console message pause right after
"Feb 9, 2009 11:31:10 AM com.jme.system.lwjgl.LWJGLDisplaySystem <init>
INFO: LWJGL Display System created."
and after the click, they resume with:
"Feb 9, 2009 11:33:02 AM com.jme.renderer.lwjgl.LWJGLRenderer <init>
INFO: LWJGLRenderer created. W:  640H: 480"

2.  The display is not redrawn while it waits.  When it loses focus and you return, the screen is black.

After the upgrade I decided to base my initialization off of SimpleJMEApplet instead of creating my own.  So, my system uses a class that extends SimpleCanvasImpl.
 
If anyone has seen this themselves, let me know.  If anyone is using JME or LWJGL in an Applet and does NOT experience this problem, let me know as well.

Thanks

Re: Clicking required to start Applet
« Reply #1 on: February 09, 2009, 18:30:26 »
This has been posted in the JME forum as well:
http://www.jmonkeyengine.com/jmeforum/index.php?topic=10380.0

*

Offline kappa

  • *****
  • 1319
Re: Clicking required to start Applet
« Reply #2 on: February 09, 2009, 19:04:28 »
does dragging a window over the applet or part of the applet start the applet? or do you have to click it to get it to start?

Re: Clicking required to start Applet
« Reply #3 on: February 10, 2009, 00:48:21 »
No, dragging a window across it does not start the applet, but it will cause the display area to go black.

*

Offline kappa

  • *****
  • 1319
Re: Clicking required to start Applet
« Reply #4 on: February 10, 2009, 09:46:21 »
Just had a quick look at SimpleJMEApplet source, looks like LWJGLCanvas still uses the old AWTGLCanvas, which suffers from an AWT validate issue when used with the appletloader, here you have to revalidate your applet again to get it started due to a new canvas being added to the Applet by the Appletloader when it switches with AWTGLCanvas.

This should be done by simply calling validate() at the start of your applet, however that does not work in all cases and you may need to force a revalidate by doing

Code: [Select]
setVisible(false);
validate();
setVisible(true);

To get proper benefit, speed and stability out of LWJGL 2 applets, JME should really be using the Display.setParent() method instead of AWTGLCanvas. Display.setParent() was the new feature added for applets in LWJGL 2 that makes applets run a lot faster and smoother than AWTGLCanvas as it totally bypasses the horrid AWT for rendering and input as the native display is used instead (technically this should make the applet run almost as fast as a LWJGL application using the native display).

Looking at LWJGLCanvas it doesn't look like it should be too much work to switch it from using AWTGLCanvas to Display.setParent().