Ejemplo n.º 1
0
  @Override
  public void stateDetached(AppStateManager stateManager) {
    System.out.println("LOGIN STATE DETACHED!");

    app.getNifty().removeScreen("LoginScreen");
    nifty.unsubscribeScreen(nifty.getScreen("LoginScreen"));
  }
Ejemplo n.º 2
0
 public void createGUI() {
   nifty.fromXml(guiLocation, "start", this);
   nifty.addControls();
   nifty.update();
   guiViewPort.addProcessor(niftyDisplay);
   timeControl =
       nifty.getScreen("start").findElementByName("timeControl").getControl(DropDownControl.class);
   setupTimeControl(timeControl);
 }
Ejemplo n.º 3
0
  private void initNifty() {
    flyCam.setDragToRotate(true);

    loginController = new LoginController();
    loginController.initialize(app.getStateManager(), app);
    nifty.registerScreenController(loginController);
    loginScreenBuilder.buildLoginScreen(nifty, loginController);
    nifty
        .getScreen("LoginScreen")
        .findNiftyControl("PasswordTextField", TextField.class)
        .enablePasswordChar('*');
  }
  @Override
  public void initialize(AppStateManager stateManager, Application app) {
    super.initialize(stateManager, app);
    this.app = (SimpleApplication) app;
    this.assetManager = this.app.getAssetManager();
    this.inputManager = this.app.getInputManager();
    this.cam = this.app.getCamera();
    this.stateManager = stateManager;
    this.guiNode = this.app.getGuiNode();
    this.rootNode = this.app.getRootNode();
    this.audioRenderer = this.app.getAudioRenderer();
    this.viewPort = this.app.getViewPort();
    this.space = this.stateManager.getState(BulletAppState.class).getPhysicsSpace();
    this.guiViewPort = this.app.getGuiViewPort();

    rootNode.attachChild(localRootNode);

    factory = new GameFactory();
    gameState = new RaceObjects();

    niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, viewPort);
    nifty = niftyDisplay.getNifty();
    nifty.fromXml("Interface/Nifty/startscreen.xml", "start", this);
    guiViewPort.addProcessor(niftyDisplay);

    audio = new AudioNode(this.app.getAssetManager(), "Sounds/default.wav");
    audio.play();
    audio.setLooping(true);

    textfield = nifty.getScreen("name").findNiftyControl("name", TextField.class);

    settingsList = nifty.getScreen("settings").findNiftyControl("resolutions", ListBox.class);
    settingsList.addItem("640*480 32bpp");
    settingsList.addItem("800*600 32bpp");
    settingsList.addItem("864*648 32bpp");
    settingsList.addItem("960*720 32bpp");
    settingsList.addItem("1024*768 32bpp");

    popup = nifty.createPopup("popupExit");
  }
Ejemplo n.º 5
0
  // refresh/build method:
  public void refresh(Nifty panel) {
    if (!visible) {
      return;
    }

    // disable other existing layers
    for (Element l : panel.getScreen("start").getLayerElements()) {
      l.disable();
    }

    Element layer =
        new LayerBuilder("journal layer") {
          {
            childLayoutAbsolute();
            width("100%");
            height("100%");
          }
        }.build(panel, panel.getScreen("start"), panel.getScreen("start").getRootElement());

    // make overall panel
    Element back =
        new PanelBuilder("back") {
          {
            childLayoutHorizontal();
            x(Integer.toString(screen_x) + "px");
            y(Integer.toString(screen_y) + "px");
            width("50%");
            height("60%");
            style("nifty-panel");
          }
        }.build(panel, panel.getScreen("start"), layer);

    // arc selection panel
    // make frame
    Element arcpanel =
        new PanelBuilder() {
          {
            childLayoutVertical();
            width("40%");
            height("100%");
            style("nifty-panel");
          }
        }.build(panel, panel.getScreen("start"), back);
    // fill with arc select panel
    panel_arc_select.refresh(panel, arcpanel, true);

    // make arc/segment edit panel
    Element arceditpanel =
        new PanelBuilder() {
          {
            childLayoutVertical();
            width("60%");
            height("100%");
          }
        }.build(panel, panel.getScreen("start"), back);

    // fill panel
    panel_arc_edit.refresh(panel, arceditpanel);
  }
Ejemplo 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);
  }