@Override
 public boolean keyEvent(final NiftyInputEvent inputEvent) {
   if (inputEvent == NiftyStandardInputEvent.Escape) {
     nifty.gotoScreen("login");
     return true;
   }
   return false;
 }
Esempio n. 2
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
  }
Esempio n. 3
0
 // main display method (overwritten by subclasses) Note: disposal of previous screen already done
 // in HUD_Main class
 public void display(Nifty n) {
   // blank hud
   n.addScreen(
       "start",
       new ScreenBuilder("start") {
         {
           // blank gui screen (e.g. for cutscenes)
         }
       }.build(n));
   // show screen
   n.gotoScreen("start");
 }
  public void nextScreen(String name) {
    if (name.equals("controls")) {
      nifty.gotoScreen(name);
    }
    if (name.equals("name")) {
      nifty.gotoScreen(name);
    }
    if (name.equals("start")) {
      nifty.gotoScreen(name);
      space.remove(car_con[index]);
      localRootNode.detachChild(cars[index]);
      localRootNode.removeLight(ai);
      localRootNode.removeLight(dl);
      localRootNode.detachChild(floor);
    }
    if (name.equals("settings")) {
      nifty.gotoScreen(name);
    }
    if (name.equals("credits")) {
      nifty.gotoScreen(name);
    }
    if (name.equals("startMenu")) {
      nifty.gotoScreen("start");
    }
    if (name.equals("carSelect")) {
      playerName = textfield.getText();

      if (!"".equals(playerName)) {
        nifty.gotoScreen(name);
        showCar();
      }
    }
    if (name.equals("startSettings")) {
      int res = settingsList.getFocusItemIndex();
      boolean fullScreen = true;
      boolean vSync = true;
      AppSettings settings = new AppSettings(true);
      settings.setFullscreen(fullScreen);
      settings.setVSync(vSync);
      settings.setResolution(width[res], height[res]);
      app.setSettings(settings);
      nifty.gotoScreen("start");
    }
  }
  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);
  }
Esempio n. 6
0
  // Initialize Nifty
  public void initNifty() {
    NiftyJmeDisplay niftyDisplay =
        new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
    Nifty nifty = niftyDisplay.getNifty();
    guiViewPort.addProcessor(niftyDisplay);

    // Add all XML files to Nifty
    nifty.addXml("Interface/XML/LogoSplash.xml");
    nifty.addXml("Interface/XML/TitleSplash.xml");
    nifty.addXml("Interface/XML/MainMenu.xml");
    nifty.addXml("Interface/XML/GameState.xml");
    nifty.addXml("Interface/XML/SettingsMenu.xml");
    nifty.addXml("Interface/XML/Loading.xml");

    // Going to the first Screen
    nifty.gotoScreen("start");

    // Setting the controller and attaching the state to the stateManager
    // logoSplash = (LogoSplashState) nifty.getScreen("start").getScreenController();
    MasterClass.mainMenu = (MainMenuState) nifty.getScreen("start").getScreenController();
    stateManager.attach(MasterClass.mainMenu);
  }
  public static void main(final String[] args) {
    if (!LwjglInitHelper.initSubSystems("Hello Nifty Builder World")) {
      System.exit(0);
    }

    // create nifty
    Nifty nifty =
        new Nifty(
            new LwjglRenderDevice(),
            new OpenALSoundDevice(),
            LwjglInitHelper.getInputSystem(),
            new AccurateTimeProvider());

    HelloNiftyBuilderExampleMain screenController = new HelloNiftyBuilderExampleMain();
    screenController.prepareStart(nifty);

    nifty.gotoScreen("start");

    // render
    LwjglInitHelper.renderLoop(nifty, null);
    LwjglInitHelper.destroy();
  }
Esempio n. 8
0
 public void switchScreen(String screenId) {
   nifty.gotoScreen(screenId);
 }
 public void quit() {
   nifty.gotoScreen("end");
 }
 private void gotoNextScreen() {
   nifty.gotoScreen("creditsMulti");
 }
Esempio n. 11
0
 public void back() {
   nifty.gotoScreen("start");
 }
Esempio n. 12
0
 public void host() {
   nifty.gotoScreen("mapselection");
   MenuApp.getInstance().getNifty().resolutionChanged();
 }