BitmapText not displayed after application start


#1

Hi i have a problem with bitmapText, each time on the start of application it works on

public void simpleInitApp() {
}

but if i try to use it out of it , it get never displayed , and i cant finde why ? ,may be i should force some update?
I’ve tried to test it with simple crossheir , just by making it added after 5 secs, and had no effect,
i can add any geometry or node ,but cant get BitmapText visible at any way

if(secondFive>5){
        
        getExe().getLabelManager().makeLabel(20, " WTF");
        BitmapFont myFont = exe.getMyAssetManager().loadFont("Interface/Fonts/Default.fnt");
    
        BitmapText myText= new BitmapText(myFont,false);
        myText.setSize(1);// lets say max rows are 15
        myText.setText("WAAAA");  
         myText.setLocalTranslation(getExe().getAppSettings().getWidth()/7,getExe().getAppSettings().getHeight()/7,0);//
        getExe().getNodesHolder().getKeysNode().attachChild(myText);
        myText.setLocalScale(getExe().getAppSettings().getWidth()/7,getExe().getAppSettings().getHeight()/7,0);

}
now label does appear but bitmapText dont soo clock works properly

this si systemprintout
null (BitmapText) 1 KeysNode (Node) 2 Gui Node (Node) 3 WAAAA

    System.out.println(myText +" 1 "+myText.getParent()+" 2 "+myText.getParent().getParent()+" 
    3 
    "+myText.getText());

May be i’ve found some walkaround ,by cloning one made on start, but lots of people complain on cloning results … soo im uncertain

i have made this , but helps nut mutch

      myText.getWorldBound().setCenter(getExe().
         getAppSettings().getWidth()/7,getExe().getAppSettings().getHeight()/7,0);

new code is

        if(secondFive>5){
        //////////////////////////
        getExe().getLabelManager().makeLabel(20, " WTF");
        BitmapFont myFont = exe.getMyAssetManager().loadFont("Interface/Fonts/Default.fnt");
    
        BitmapText myText=
                new BitmapText(myFont, true);
        
        getExe().getNodesHolder().getKeysNode().attachChild(myText);
        myText.setSize(10);// lets say max rows are 15
        myText.setText("WAAAA");  
         myText.setLocalTranslation(getExe().getAppSettings().
      getWidth()/7,getExe().getAppSettings().getHeight()/7,0);//
        myText.setLocalScale(getExe().getAppSettings().
         getWidth()/7,getExe().getAppSettings().getHeight()/7,0);
        myText.getWorldBound().setCenter(getExe().
       getAppSettings().getWidth()/7,getExe().getAppSettings().getHeight()/7,0);
        
        System.out.println(myText +" 1 "+myText.getParent()+" 2 
          "+myText.getParent().getParent()+" 3 "+myText.getText());
        System.out.println(myText.getWorldBound());
        System.out.println(myText.getWorldTranslation());
        
        //////////////////////////////////

systemouts are :

null (BitmapText) 1 KeysNode (Node) 2 Gui Node (Node) 3 WAAAA
BoundingBox [Center: (205.0, 128.0, 0.0) xExtent: 0.0 yExtent: 0.0 zExtent: 0.0]
(205.0, 128.0, 0.0)


#2

When in doubt, print the world bounds to system out. Work back from there.


#3

BoundingBox [Center: (-98195.0, 1395.2, 0.0) xExtent: 0.0 yExtent: 0.0 zExtent: 0.0]


#4

Those numbers are madness. If that’s supposed to be in the gui node the center is miiiiiles off the screen coordinates and it has a size of zero - so there’s nothing to even see.


#5

i’ve used to place it manually soo now its at
(205.0, 128.0, 0.0)
and i cant see it , but if i do it at up start i can see it at same coordinates


#6

The WORLD bounding box is at 205, 128, 0? Or you are just setting it to that and hoping?

Without println output, I don’t really believe you at this point.


#7

Also, 0, 0, 0 extents means your world scale is probably 0.

All of that odd indirection is a mess and it’s coming back to haunt you. The random rescaling at all different levels in an unorganized/unplanned-out way is making things weird when you do it again later. Something is accumulating that shouldn’t be.