Ejemplo n.º 1
0
  @Override
  public void simpleInitApp() {
    NiftyJmeDisplay niftyDisplay =
        new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
    Nifty nifty = niftyDisplay.getNifty();
    guiViewPort.addProcessor(niftyDisplay);
    flyCam.setDragToRotate(true);

    nifty.loadStyleFile("nifty-default-styles.xml");
    nifty.loadControlFile("nifty-default-controls.xml");

    // <screen>
    nifty.addScreen(
        "Screen_ID",
        new ScreenBuilder("Hello Nifty Screen") {
          {
            controller(new DefaultScreenController()); // Screen properties

            // <layer>
            layer(
                new LayerBuilder("Layer_ID") {
                  {
                    childLayoutVertical(); // layer properties, add more...

                    // <panel>
                    panel(
                        new PanelBuilder("Panel_ID") {
                          {
                            childLayoutCenter(); // panel properties, add more...

                            // GUI elements
                            control(
                                new ButtonBuilder("Button_ID", "Hello Nifty") {
                                  {
                                    alignCenter();
                                    valignCenter();
                                    height("5%");
                                    width("15%");
                                  }
                                });

                            // .. add more GUI elements here

                          }
                        });
                    // </panel>
                  }
                });
            // </layer>

          }
        }.build(nifty));

    // </screen>

    nifty.gotoScreen("Screen_ID"); // start the screen
  }
  public void simpleInitApp() {
    NiftyJmeDisplay niftyDisplay =
        new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
    nifty = niftyDisplay.getNifty();
    nifty.loadStyleFile("nifty-default-styles.xml");
    nifty.loadControlFile("nifty-default-controls.xml");
    // create nifty
    nifty.registerEffect("customHint", "rpgTest.ui.test.CustomHint");

    nifty.addScreen("start", makeScreen1(nifty));
    nifty.gotoScreen("start");

    // attach the nifty display to the gui view port as a processor
    guiViewPort.addProcessor(niftyDisplay);

    // disable the fly cam
    flyCam.setEnabled(false);
  }