Skip to main content
Integrated comments.
Source Link
Vaillancourt
  • 16.4k
  • 17
  • 56
  • 61

Initially i was not able to render multiple texts based on the number of nodes present in model. I wanted to render multiple text at different position so I achieved with this code. There was no error, but I was not able to achieve what I wanted i.e. rendering multiple text.

   for (Widget widgets :
            display.getWidgets()) {
 
        
        for (int i = 0; i < widgets.nodes.size; i++) {

            Node node = widgets.nodes.get(i);
            if (node.id.equalsIgnoreCase("Camera") || node.id.equalsIgnoreCase("lamp")) {
 
}
        } 
        else {
                BoundingBox nodeBox = new BoundingBox();
                final Vector3 center = new Vector3();

                node.calculateBoundingBox(nodeBox);
                nodeBox.getCenter(center);
             if (count == if(count==00) {
                    font.draw(spriteBatch, 
 "Hello"+count, center.x
                  spriteBatch, "Hello" + count,  
                    center.x, center.y, nodeBox.getWidth()*25 * 25, Align.center, true);

                ++count;
    ++count;
        }
            else {
                }
font.draw(
                else{


    spriteBatch, "Hello" + count,  
                font.draw(spriteBatch, "Hello"+count,   center.x, center.y, nodeBox.getWidth()*25 * 25, Align.center, true);
                    xPos = xPos+(boxWidth*2);
               xPos + (boxWidth * 2); ++count;
             
                }
            }
        }

 
    }
   for (Widget widgets :
            display.getWidgets()) {
 
        
        for (int i = 0; i < widgets.nodes.size; i++) {

            Node node = widgets.nodes.get(i);
            if(node.id.equalsIgnoreCase("Camera") || node.id.equalsIgnoreCase("lamp")){
 
}
                else {
                BoundingBox nodeBox = new BoundingBox();
                final Vector3 center = new Vector3();

                node.calculateBoundingBox(nodeBox);
                nodeBox.getCenter(center);
                if(count==0) {
                    font.draw(spriteBatch, "Hello"+count, center.x
                            , center.y, nodeBox.getWidth()*25, Align.center, true);

                    ++count;
                    
                }

                else{


                    font.draw(spriteBatch, "Hello"+count,center.x, center.y, nodeBox.getWidth()*25,Align.center, true);
                    xPos = xPos+(boxWidth*2);
                    ++count;
             
                }
            }
        }

 
    }

Initially i was not able to render multiple texts based on the number of nodes present in model. I wanted to render multiple text at different position so I achieved with this code. There was no error, but I was not able to achieve what I wanted i.e. rendering multiple text.

for (Widget widgets: display.getWidgets()) {

    for (int i = 0; i < widgets.nodes.size; i++) {

        Node node = widgets.nodes.get(i);
        if (node.id.equalsIgnoreCase("Camera") || node.id.equalsIgnoreCase("lamp")) {
        } 
        else {
            BoundingBox nodeBox = new BoundingBox();
            final Vector3 center = new Vector3();

            node.calculateBoundingBox(nodeBox);
            nodeBox.getCenter(center);
            if (count == 0) {
                font.draw( 
                    spriteBatch, "Hello" + count,  
                    center.x, center.y, nodeBox.getWidth() * 25, Align.center, true);

                ++count;
            }
            else {
                font.draw(
                    spriteBatch, "Hello" + count,  
                    center.x, center.y, nodeBox.getWidth() * 25, Align.center, true);
                xPos = xPos + (boxWidth * 2); ++count;
            }
        }
    }
}
Source Link

   for (Widget widgets :
            display.getWidgets()) {

        
        for (int i = 0; i < widgets.nodes.size; i++) {

            Node node = widgets.nodes.get(i);
            if(node.id.equalsIgnoreCase("Camera") || node.id.equalsIgnoreCase("lamp")){

}
                else {
                BoundingBox nodeBox = new BoundingBox();
                final Vector3 center = new Vector3();

                node.calculateBoundingBox(nodeBox);
                nodeBox.getCenter(center);
                if(count==0) {
                    font.draw(spriteBatch, "Hello"+count, center.x
                            , center.y, nodeBox.getWidth()*25, Align.center, true);

                    ++count;
                    
                }

                else{


                    font.draw(spriteBatch, "Hello"+count,center.x, center.y, nodeBox.getWidth()*25,Align.center, true);
                    xPos = xPos+(boxWidth*2);
                    ++count;
             
                }
            }
        }


    }