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
This commit is contained in:
parent
9264e0ea32
commit
4dd46f4c5b
@ -66,7 +66,7 @@ public class TestChangeAppIcon extends SimpleApplication {
|
|||||||
@Override
|
@Override
|
||||||
public void simpleInitApp() {
|
public void simpleInitApp() {
|
||||||
// Write text on the screen (HUD)
|
// Write text on the screen (HUD)
|
||||||
guiNode.detachAllChildren();
|
setDisplayStatView(false);
|
||||||
BitmapText helloText = new BitmapText(guiFont);
|
BitmapText helloText = new BitmapText(guiFont);
|
||||||
helloText.setText("The icon of the app should be a smart monkey!");
|
helloText.setText("The icon of the app should be a smart monkey!");
|
||||||
helloText.setLocalTranslation(300, helloText.getLineHeight(), 0);
|
helloText.setLocalTranslation(300, helloText.getLineHeight(), 0);
|
||||||
|
@ -69,7 +69,7 @@ public class HelloAssets extends SimpleApplication {
|
|||||||
rootNode.attachChild(wall);
|
rootNode.attachChild(wall);
|
||||||
|
|
||||||
/** Display a line of text (default font from test-data) */
|
/** Display a line of text (default font from test-data) */
|
||||||
guiNode.detachAllChildren();
|
setDisplayStatView(false);
|
||||||
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
|
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
|
||||||
BitmapText helloText = new BitmapText(guiFont, false);
|
BitmapText helloText = new BitmapText(guiFont, false);
|
||||||
helloText.setSize(guiFont.getCharSet().getRenderedSize());
|
helloText.setSize(guiFont.getCharSet().getRenderedSize());
|
||||||
|
@ -215,14 +215,14 @@ public class HelloPhysics extends SimpleApplication {
|
|||||||
|
|
||||||
/** A plus sign used as crosshairs to help the player with aiming.*/
|
/** A plus sign used as crosshairs to help the player with aiming.*/
|
||||||
protected void initCrossHairs() {
|
protected void initCrossHairs() {
|
||||||
guiNode.detachAllChildren();
|
setDisplayStatView(false);
|
||||||
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
|
//guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
|
||||||
BitmapText ch = new BitmapText(guiFont, false);
|
BitmapText ch = new BitmapText(guiFont, false);
|
||||||
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
|
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
|
||||||
ch.setText("+"); // fake crosshairs :)
|
ch.setText("+"); // fake crosshairs :)
|
||||||
ch.setLocalTranslation( // center
|
ch.setLocalTranslation( // center
|
||||||
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
|
settings.getWidth() / 2,
|
||||||
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
|
settings.getHeight() / 2, 0);
|
||||||
guiNode.attachChild(ch);
|
guiNode.attachChild(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,14 +154,13 @@ public class HelloPicking extends SimpleApplication {
|
|||||||
|
|
||||||
/** A centred plus sign to help the player aim. */
|
/** A centred plus sign to help the player aim. */
|
||||||
protected void initCrossHairs() {
|
protected void initCrossHairs() {
|
||||||
guiNode.detachAllChildren();
|
setDisplayStatView(false);
|
||||||
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
|
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
|
||||||
BitmapText ch = new BitmapText(guiFont, false);
|
BitmapText ch = new BitmapText(guiFont, false);
|
||||||
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
|
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
|
||||||
ch.setText("+"); // crosshairs
|
ch.setText("+"); // crosshairs
|
||||||
ch.setLocalTranslation( // center
|
ch.setLocalTranslation( // center
|
||||||
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
|
settings.getWidth() / 2, settings.getHeight() / 2, 0);
|
||||||
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
|
|
||||||
guiNode.attachChild(ch);
|
guiNode.attachChild(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user