瀏覽代碼

jme3tests: Updated HUD code to use setDisplayStatView(false) instead of guideNode.detachAll(). Recentered crosshairs.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9399 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
roo..li 13 年之前
父節點
當前提交
4dd46f4c5b

+ 1 - 1
engine/src/test/jme3test/app/TestChangeAppIcon.java

@@ -66,7 +66,7 @@ public class TestChangeAppIcon extends SimpleApplication {
     @Override
     public void simpleInitApp() {
         // Write text on the screen (HUD)
-        guiNode.detachAllChildren();
+        setDisplayStatView(false);
         BitmapText helloText = new BitmapText(guiFont);
         helloText.setText("The icon of the app should be a smart monkey!");
         helloText.setLocalTranslation(300, helloText.getLineHeight(), 0);

+ 1 - 1
engine/src/test/jme3test/helloworld/HelloAssets.java

@@ -69,7 +69,7 @@ public class HelloAssets extends SimpleApplication {
         rootNode.attachChild(wall);
 
         /** Display a line of text (default font from test-data) */
-        guiNode.detachAllChildren();
+        setDisplayStatView(false);
         guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
         BitmapText helloText = new BitmapText(guiFont, false);
         helloText.setSize(guiFont.getCharSet().getRenderedSize());

+ 4 - 4
engine/src/test/jme3test/helloworld/HelloPhysics.java

@@ -215,14 +215,14 @@ public class HelloPhysics extends SimpleApplication {
 
   /** A plus sign used as crosshairs to help the player with aiming.*/
   protected void initCrossHairs() {
-    guiNode.detachAllChildren();
-    guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
+    setDisplayStatView(false);
+    //guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
     BitmapText ch = new BitmapText(guiFont, false);
     ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
     ch.setText("+");        // fake crosshairs :)
     ch.setLocalTranslation( // center
-      settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
-      settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
+      settings.getWidth() / 2,
+      settings.getHeight() / 2, 0);
     guiNode.attachChild(ch);
   }
 }

+ 2 - 3
engine/src/test/jme3test/helloworld/HelloPicking.java

@@ -154,14 +154,13 @@ public class HelloPicking extends SimpleApplication {
 
   /** A centred plus sign to help the player aim. */
   protected void initCrossHairs() {
-    guiNode.detachAllChildren();
+    setDisplayStatView(false);
     guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
     BitmapText ch = new BitmapText(guiFont, false);
     ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
     ch.setText("+"); // crosshairs
     ch.setLocalTranslation( // center
-      settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
-      settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
+      settings.getWidth() / 2, settings.getHeight() / 2, 0);
     guiNode.attachChild(ch);
   }