Questions :)

Hello jME Community, i have some question and I thought you guys could help me with them:


  1. How can i add like a internal window in jME App (Like when you run the game and see your 3d world)? Cause i want to add a chat room in there.  :?


  2. How to setup a static camera? So the players could not move it.  :?





    Regards, :slight_smile:

Look at examples:



TestCameraMan.java

TestCameraNode.java





That should give you the answer :wink:

Phoenix already touched on the camera question so I’ll cover the GUI question.



Look here for information on creating a GUI in your jME game.  The short answer is that there’s two different systems that people mainly use, FengGUI and GBUI.  You’ll find fans and haters for both :slight_smile:

Where can I find TestCameraMan.java and TestCameraNode.java ?  :?

In the jme source, in the jmetest.renderer package.

Okay, i saw a full tutorial o GBUI but could not understand nothing to start making my own interface. I just want to create a window, a text field and a button. nothing more than that :confused: - can someone giveme a code as example?



Another question: I saw the code of TestCameraNode.java and i have make one code for me:


   private CameraNode camNode;

   camNode = new CameraNode("Camera Node", display.getRenderer().getCamera());
        input = new NodeHandler(camNode, 15f, 1);
        
        Vector3f max = new Vector3f(5,5,5);
        Vector3f min = new Vector3f(-5,-5,-5);   

   Box cB = new Box("Camera Box", min.divide(4), max.divide(4));
        cB.setLocalTranslation(new Vector3f(-5,0,10));
        cB.setModelBound(new BoundingSphere());
        cB.updateModelBound();

   camNode.setLocalTranslation(new Vector3f(0,0,10));
        camNode.attachChild(cB);
        rootNode.attachChild(camNode);



Question: In which part of the code i setup the camera look to a especific point?

Here is a very simple example of using GBUI.

Notice though that in this test I'm using SimpleGame and if you're using multithreading you should make sure that windows get added in the OpenGL thread.


//Initiate BuiSystem
      BuiSystem.init(new PolledRootNode(Timer.getTimer(), new InputHandler()), "/rsrc/style2.bss");
        //Attach the rootNode to our rootNode
      rootNode.attachChild(BuiSystem.getRootNode());
      
      //Show mouse cursor
      MouseInput.get().setCursorVisible(true);
       
      //Create a static window
        BWindow window = new BWindow("Window", BuiSystem.getStyle(), GroupLayout.makeVert(Justification.CENTER));
        //Set the size of this window
        window.setSize(300, 200);
        //Add a colour background to the window
        window.setBackground(BWindow.DEFAULT, new TintedBackground(ColorRGBA.randomColor()));
       
        //Create an empty text field (final in this test so it's available in the ActionListener below)
        final BTextField tf = new BTextField();
        //Set the preferred size of this text field
        tf.setPreferredSize(100, 30);
       
        //Create a label (final in this test so it's available in the ActionListener below)
        final BLabel label = new BLabel("You wrote:");
       
        //Create a button with an action listener
        BButton button = new BButton("Button", new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent event) {
            label.setText("You wrote: "+tf.getText());
         }
        }, "click");
        button.setPreferredSize(70,40);
       
        //Add text field, button and label to window
        window.add(tf);
        window.add(button);
        window.add(label);
       
        //Center window
        window.center();
        //Add window to BuiSystem
        BuiSystem.addWindow(window);

Another nobo question, where can i find style2.bss??? :slight_smile:

If you have the latest GBUI source, it's in the rsrc folder.