Bitmap Text goes black

This must be the most important part of code


public void initMakeString(){

  setDisplayStatView(false);
 guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");

   BitmapText helloText = new BitmapText(guiFont= assetManager.loadFont("Interface/Fonts/Default.fnt"), false);
  

   helloText.setLocalTranslation(300, helloText.getLineHeight(), 0);
    helloText.setSize(guiFont.getCharSet().getRenderedSize());
     guiNode2.detachAllChildren();
    guiNode2.attachChild(helloText);
    bT.add(helloText);

    helloText.setText(scritta);
    first=false;

  }
float x=5;
String scritta="start"; 
 String helloText1="helloText";
    float gameSpedd = 0.1f ;
   int ora=0 ;
 @Override
public void simpleUpdate(float tpf){
 float tpfMeter = tpf;

  x=  x+(gameSpedd*tpf);
  int minuto = (int) (x*10);
  if (x>6){
      x=0;
  ora++;
  if(ora>23)ora=0;
  //esegui classe get name ora toString
  }
  
  scritta = "timer"+ora+":"+minuto+"sparo";
  bT.get(0).setText(scritta);
}  

seems happens all the times ,just take some time may be 10 secs or a bit more

and this is whole class

package jme3test.helloworld;

import com.jme3.app.SimpleApplication;
import com.jme3.asset.TextureKey;
import com.jme3.bullet.BulletAppState;

import com.jme3.bullet.collision.PhysicsCollisionEvent;
import com.jme3.bullet.collision.PhysicsCollisionListener;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.input.MouseInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.MouseButtonTrigger;
import com.jme3.material.Material;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Box;
import com.jme3.scene.shape.Sphere;
import com.jme3.scene.shape.Sphere.TextureMode;
import com.jme3.texture.Texture;
import com.jme3.texture.Texture.WrapMode;
import java.util.ArrayList;
import java.util.List;
import sun.org.mozilla.javascript.internal.ast.ForLoop;

/**

  • Example 12 - how to give objects physical properties so they bounce and fall.
  • @author base code by double1984, updated by zathras
    */
    public class HelloPhysics extends SimpleApplication implements PhysicsCollisionListener{

public static void main(String args[]) {

HelloPhysics app = new HelloPhysics();
app.start();

}

/** Prepare the Physics Application State (jBullet) */
private BulletAppState bulletAppState;

/** Prepare Materials */
Material wall_mat;
Material stone_mat;
Material floor_mat;

/** Prepare geometries and physical nodes for bricks and cannon balls. */

private RigidBodyControl brick_phy;
private static final Box box;
private RigidBodyControl ball_phy;
private static final Sphere sphere;
private RigidBodyControl floor_phy;
private static final Box floor;

/** dimensions used for bricks and wall */
private static final float brickLength = 0.48f;
private static final float brickWidth = 0.24f;
private static final float brickHeight = 0.12f;

static {
/** Initialize the cannon ball geometry /
sphere = new Sphere(32, 32, 0.4f, true, false);
sphere.setTextureMode(TextureMode.Projected);
/
* Initialize the brick geometry /
box = new Box(brickLength, brickHeight, brickWidth);
box.scaleTextureCoordinates(new Vector2f(1f, .5f));
/
* Initialize the floor geometry */
floor = new Box(10f, 0.1f, 5f);
floor.scaleTextureCoordinates(new Vector2f(3, 6));
}

public Node guiNode2 = new Node(“Gui Node2”);

@Override
public void simpleInitApp() {
/** Set up Physics Game */
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
//bulletAppState.getPhysicsSpace().enableDebug(assetManager);

/** Configure cam to look at scene */
cam.setLocation(new Vector3f(0, 4f, 6f));
cam.lookAt(new Vector3f(2, 2, 0), Vector3f.UNIT_Y);
/** Add InputManager action: Left click triggers shooting. */
inputManager.addMapping("shoot", 
        new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addListener(actionListener, "shoot");
/** Initialize the scene, materials, and physics space */
initMaterials();
initWall();
initFloor();
initCrossHairs();
initMakeString();

guiNode.attachChild(guiNode2);

}

/*

  • Every time the shoot action is triggered, a new cannon ball is produced.

  • The ball is set up to fly from the camera position in the camera direction.
    */
    private ActionListener actionListener = new ActionListener() {
    public void onAction(String name, boolean keyPressed, float tpf) {
    if (name.equals(“shoot”) && !keyPressed) {
    makeCannonBall();

    //updateString();
    }
    }
    };

/** Initialize the materials used in this scene. */
public void initMaterials() {
wall_mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
TextureKey key = new TextureKey(“Textures/Terrain/BrickWall/BrickWall.jpg”);
key.setGenerateMips(true);
Texture tex = assetManager.loadTexture(key);
wall_mat.setTexture(“ColorMap”, tex);

stone_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG");
key2.setGenerateMips(true);
Texture tex2 = assetManager.loadTexture(key2);
stone_mat.setTexture("ColorMap", tex2);

floor_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.jpg");
key3.setGenerateMips(true);
Texture tex3 = assetManager.loadTexture(key3);
tex3.setWrap(WrapMode.Repeat);
floor_mat.setTexture("ColorMap", tex3);

}

/** Make a solid floor and add it to the scene. /
public void initFloor() {
Geometry floor_geo = new Geometry(“Floor”, floor);
floor_geo.setMaterial(floor_mat);
floor_geo.setLocalTranslation(0, -0.1f, 0);
this.rootNode.attachChild(floor_geo);
/
Make the floor physical with mass 0.0f! */
floor_phy = new RigidBodyControl(0.0f);
floor_geo.addControl(floor_phy);
bulletAppState.getPhysicsSpace().add(floor_phy);
}

/** This loop builds a wall out of individual bricks. */
public void initWall() {
float startpt = brickLength / 4;
float height = 0;
for (int j = 0; j < 15; j++) {
for (int i = 0; i < 6; i++) {
Vector3f vt =
new Vector3f(i * brickLength * 2 + startpt, brickHeight + height, 0);
makeBrick(vt);
}
startpt = -startpt;
height += 2 * brickHeight;
}
}

/** This method creates one individual physical brick. /
public void makeBrick(Vector3f loc) {
/
* Create a brick geometry and attach to scene graph. /
Geometry brick_geo = new Geometry(“brick”, box);
brick_geo.setMaterial(wall_mat);
rootNode.attachChild(brick_geo);
/
* Position the brick geometry /
brick_geo.setLocalTranslation(loc);
/
* Make brick physical with a mass > 0.0f. /
brick_phy = new RigidBodyControl(2f);
/
* Add physical brick to physics space. */
brick_geo.addControl(brick_phy);
bulletAppState.getPhysicsSpace().add(brick_phy);

}
Boolean first = true;

List<BitmapText>bT = new ArrayList<BitmapText>();

public void initMakeString(){

 //guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
   BitmapText helloText = new BitmapText(guiFont= assetManager.loadFont("Interface/Fonts/Default.fnt"), false);
  

   helloText.setLocalTranslation(300, helloText.getLineHeight(), 0);
    helloText.setSize(guiFont.getCharSet().getRenderedSize());
     guiNode2.detachAllChildren();
    guiNode2.attachChild(helloText);
    bT.add(helloText);

    helloText.setText(scritta);
    first=false;

    }
 float x=5;
 String scritta="start"; 
 String helloText1="helloText";
 float gameSpedd = 0.1f ;
 int ora=0 ;
   @Override
public void simpleUpdate(float tpf){
   float tpfMeter = tpf;

  x=  x+(gameSpedd*tpf);
  int minuto = (int) (x*10);
  if (x>6){
      x=0;
  ora++;
  if(ora>23)ora=0;
 
  }
  
  scritta = "timer"+ora+":"+minuto+"sparo";
  bT.get(0).setText(scritta);

}
/** This method creates one individual physical cannon ball.

  • By defaul, the ball is accelerated and flies
  • from the camera position in the camera direction.*/

public void makeCannonBall() {

/** Create a cannon ball geometry and attach to scene graph. */
   
Geometry ball_geo = new Geometry("cannon ball", sphere);
ball_geo.setMaterial(stone_mat);
rootNode.attachChild(ball_geo);
/** Position the cannon ball  */
ball_geo.setLocalTranslation(cam.getLocation());
/** Make the ball physcial with a mass > 0.0f */
ball_phy = new RigidBodyControl(1f);

/** Add physical ball to physics space. */
ball_geo.addControl(ball_phy);
bulletAppState.getPhysicsSpace().add(ball_phy);
/** Accelerate the physcial ball to shoot it. */
ball_phy.setLinearVelocity(cam.getDirection().mult(25));

bulletAppState.getPhysicsSpace().addCollisionListener(this);

}

/** A plus sign used as crosshairs to help the player with aiming.*/

protected void initCrossHairs() {
guiNode.detachAllChildren();
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);
guiNode.attachChild(ch);
}

public void collision(PhysicsCollisionEvent event) {
 String name;
 if ( event.getNodeA().getName().equals("cannon ball") ) {
 name =event.getNodeA().getName();
 event.getNodeA().removeFromParent();
   }   else if ( event.getNodeB().getName().equals("cannon ball") ) {
   for (int i = 9; i < 10; i++) {
     rootNode.getChild("cannon ball").setName("21");
    name = event.getNodeB().getName();
 bulletAppState.getPhysicsSpace().remove(event.getNodeA().getControl(RigidBodyControl.class));
event.getNodeA().removeFromParent();
event.getNodeB().removeFromParent();
event.getNodeB().updateGeometricState();
rootNode.updateGeometricState();
break;
}}
}
}
1 Like

Use

```
CODE HERE
```

when you post code plz

2 Likes

but i tried windowed and full screen ,and seems it happens only when i keep it in first plan,if i alt tab it and let it in back ground seems not getting black untill i take it up and watch for at least 10 seconds.
I’ve noticed as well some little window try to appear before it goes blask ,bit its too fast and small to see what it is

1 Like

KEK, you have to use only 3 back ticks or it won’t work properly. (How to type code blocks )

But anyway if it happens only sometimes the issue might be elsewhere, also when you alt tab the game will pause unless you disable the pause on lost focus.

A small test case might be useful to isolate the problem.

1 Like

naah i noticed it happens all the times if i just wait the time it takes
i’v made a screen shoot but cant upload it… must be too huge :frowning: 34kb was pretty small for me ,but :frowning:

any way it turn like wrote by black marker and become impossible to read

1 Like

0 is too big. We don’t let you upload stuff because there are many way better image hosting sites.

http://imgur.com is the best one, really.

1 Like

Imgur
hote it works,first time try it :slight_smile:

1 Like

Hi, would it then not better to just remove this upload button if you can’t use it anyway?!

1 Like

And if you want help you will need to post the whole single class test case… using the code posting approach already mentioned… and the one that is described in a sticky topic on the forum, etc…

1 Like

Go ahead and take over server management. I don’t do anything with that. You are welcome to it, I guess.

Bottom line, we don’t host images anymore because we were constantly running out of space.

1 Like

well men i did ,but it was soo huge i removed it… but ok i will get it back :slight_smile: just dont say im shooting walls of text :smiley:

1 Like

No.

Simplify it into a single class test case that exhibits the problem.

99.99999999999999999999% of the time, it will work fine for you. Then you can see what is wrong with your “giant file that no one will actually read”.

1 Like

Ah okay, did not know that. I thought every core dev (leader of jme) can do things like this.

1 Like

I would rather pull off every one of my toe nails with a pair of pliers and then jam them into the space between my gums and teeth than manage the JME web server.

Fortunately, helping maintain a 3D graphics engine doesn’t require that sort of knowledge.

edit: to change “a web server” to “the JME web server”… since I’m forced to manage my own stupid web servers by default… and every single time I longingly look at my pair of pliers.

4 Likes

Ok i could actually F** r** or Kill some 1 right now… it was PlayTv …it messed soo many of my games and mods when i was play them… but for gods sake ,just wtf ,just how T.F and WhyT.F. … i wasted like 4 hours to finde it was Play Tv to messing every thing…i’ve even forbiden it from registering on will… aaaahhhhhh … well any way sorry guys it was a false allarm code is working and avery thing is pretty fine ,it was just Play Tv post is solved .

1 Like

Install Gentoo.

2 Likes

ehm what is it?

1 Like

Nevermind, it was a joke :chipmunk:. It’s a gnu/linux distro.

1 Like

Oh what lovely <3 a linux uset <3 . Set tourches on fire !! get Forks ready !! we are going on hunt !!! GET HIM!!!
Just joking men just joking <3 :smiley:

1 Like

If i lower the max image size setting to zero the button is removed, however it also disables avatar uploads. Other than css, there is no setting. So unfortunately theres no way to remove the button. Sorry. An attempt was made. Ill look into the css maybe. Im not certain of the repercussions without paying more attention. Ill see if there is a happy medium somewhere.

This thread has suggestions, but nothing more than work-arounds.

2 Likes