@Override public boolean keyEvent(final NiftyInputEvent inputEvent) { if (inputEvent == NiftyStandardInputEvent.Escape) { nifty.gotoScreen("login"); return true; } return false; }
@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 }
// 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); }
// 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(); }
public void switchScreen(String screenId) { nifty.gotoScreen(screenId); }
public void quit() { nifty.gotoScreen("end"); }
private void gotoNextScreen() { nifty.gotoScreen("creditsMulti"); }
public void back() { nifty.gotoScreen("start"); }
public void host() { nifty.gotoScreen("mapselection"); MenuApp.getInstance().getNifty().resolutionChanged(); }