Standard game minor bug fix [commited]

Recently reInitVideo and reInitAudio were added to basegame. ReinitVideo has to be done in the update queue. recreateGraphicalContext calls reInitVideo & audio and is thrown in the update queue, whereas reinitvideo only should be, so that reinitvideo can be called from the user program without queuing it in the update.  :slight_smile:





Index: src/com/jmex/game/StandardGame.java
===================================================================
--- src/com/jmex/game/StandardGame.java   (revision 4035)
+++ src/com/jmex/game/StandardGame.java   (working copy)
@@ -381,27 +381,29 @@
             AudioSystem.getSystem().cleanup();
         }
     }
-   
-    public void reinitVideo() {
-        displayMins();
-       
-        display.recreateWindow(settings.getWidth(), settings.getHeight(), settings.getDepth(), settings.getFrequency(),
-                        settings.isFullscreen());
-        camera = display.getRenderer().createCamera(display.getWidth(), display.getHeight());
-        display.getRenderer().setBackgroundColor(backgroundColor);
-        if ((settings.isMusic()) || (settings.isSFX())) {
-            initSound();
-        }
-    }
 
-    public void recreateGraphicalContext() {
-        GameTaskQueueManager.getManager().update(new Callable<Object>() {
-            public Object call() throws Exception {
-                reinit();
-                return null;
-            }
-        });
-    }
+   public void reinitVideo() {
+      GameTaskQueueManager.getManager().update(new Callable<Object>() {
+         public Object call() throws Exception {
+            displayMins();
+
+            display.recreateWindow(settings.getWidth(), settings
+                  .getHeight(), settings.getDepth(), settings
+                  .getFrequency(), settings.isFullscreen());
+            camera = display.getRenderer().createCamera(display.getWidth(),
+                  display.getHeight());
+            display.getRenderer().setBackgroundColor(backgroundColor);
+            if ((settings.isMusic()) || (settings.isSFX())) {
+               initSound();
+            }
+            return null;
+         }
+      });
+   }
+
+   public void recreateGraphicalContext() {
+      reinit();
+   }
 
     protected void cleanup() {
         GameStateManager.getInstance().cleanup();

You meant StandardGame not BaseGame :slight_smile:



Is there any Problem with the current way it works?

Yes : with the existing, either you reinit video+audio with recreateGraphicalContext() that queue the reinitvideo + reinitaudio in the update, either you want to reinit video and you must enqueue it yourself



With the patch you can either recreate one or both without enqueue none



discuted here : http://www.jmonkeyengine.com/jmeforum/index.php?topic=5812.0



Kine  :slight_smile:

ok makes sense, i commit it soon if no one else has any objections.

no objections.

hehe ok 'soon' is realtive.

committed,

kine, can you add a [committed] to the topic and change 'Base game' to 'StandardGame' to avoid confusion?



on a side note: recreateWindow() and many other things are not yet implemented in JOGL, so if anyone is bored … :slight_smile: