public void quit(){ nifty.gotoScreen("end"); }
public void endInput() { boolean result = nifty.update(); }
/** * Invoked when the event is stopped. */ @Override public void onStop() { if (nifty.getCurrentScreen() != null) { nifty.getCurrentScreen().endScreen(null); } }
private NiftyJmeDisplay( final AssetManager assetManager, final InputManager inputManager, final AudioRenderer audioRenderer, final ViewPort viewport, final BatchRenderConfiguration batchRenderConfiguration) { initialize(assetManager, inputManager, audioRenderer, viewport); this.renderDev = null; this.batchRendererBackend = new JmeBatchRenderBackend(this); nifty = new Nifty( new BatchRenderDevice(batchRendererBackend, batchRenderConfiguration), soundDev, inputSys, new AccurateTimeProvider()); inputSys.setNifty(nifty); resourceLocation = new ResourceLocationJme(); nifty.getResourceLoader().removeAllResourceLocations(); nifty.getResourceLoader().addResourceLocation(resourceLocation); }
@Override public void onPlay() { super.onPlay(); nifty.getScreen(screen).findElementById("text") .getRenderer(TextRenderer.class).setText(text); }
boolean consumed = nic.processMouseEvent(x, y, 0, button, true) | nifty.getCurrentScreen().isMouseOverElement(); niftyOwnsDragging[button] = consumed; if (consumed) { boolean consumed = nic.processMouseEvent(x, y, 0, button, false);
private void onKeyEventQueued(KeyInputEvent evt, NiftyInputConsumer nic) { int code = evt.getKeyCode(); if (code == KeyInput.KEY_LSHIFT || code == KeyInput.KEY_RSHIFT) { shiftDown = evt.isPressed(); } else if (code == KeyInput.KEY_LCONTROL || code == KeyInput.KEY_RCONTROL) { ctrlDown = evt.isPressed(); } KeyboardInputEvent keyEvt = new KeyboardInputEvent(code, evt.getKeyChar(), evt.isPressed(), shiftDown, ctrlDown); if (nic.processKeyboardEvent(keyEvt)) { evt.setConsumed(); } }
@NiftyEventSubscriber(id="DeviceListBox") public void onDeviceChanged(String id, ListBoxSelectionChangedEvent<String> event) { String d = event.getSelection().isEmpty() ? null : event.getSelection().get(0); LOG.log(Level.INFO, "Selected device changed to {0}", d); selectedDevice = d; }
private void onMouseMotionEventQueued(MouseMotionEvent evt, NiftyInputConsumer nic) { int wheel = evt.getDeltaWheel() / 120; x = evt.getX(); y = height - evt.getY(); nic.processMouseEvent(x, y, wheel, -1, false); // if (nic.processMouseEvent(niftyEvt) /*|| nifty.getCurrentScreen().isMouseOverElement()*/){ // Do not consume motion events //evt.setConsumed(); // } }
public void simpleInitApp() { NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort); nifty = niftyDisplay.getNifty(); nifty.fromXml("all/intro.xml", "start"); // attach the nifty display to the gui view port as a processor guiViewPort.addProcessor(niftyDisplay); // disable the fly cam flyCam.setEnabled(false); }
public void reshape(ViewPort vp, int w, int h) { this.w = w; this.h = h; inputSys.setHeight(h); nifty.resolutionChanged(); }
@NiftyEventSubscriber(id="ApplyButton") public void onButton(String id, ButtonClickedEvent event) { LOG.log(Level.INFO, "Change context: platorm={0}, device={1}", new Object[]{selectedPlatform, selectedDevice}); restart(); }
public void postQueue(RenderQueue rq) { // render nifty before anything else renderManager.setCamera(vp.getCamera(), true); //nifty.update(); nifty.render(false); renderManager.setCamera(vp.getCamera(), false); }
/** * Create a standard NiftyJmeDisplay. This uses the old Nifty renderer. It's probably slower then the batched * renderer and is mainly here for backwards compatibility. * * @param assetManager jME AssetManager * @param inputManager jME InputManager * @param audioRenderer jME AudioRenderer * @param vp Viewport to use */ public NiftyJmeDisplay(AssetManager assetManager, InputManager inputManager, AudioRenderer audioRenderer, ViewPort vp){ initialize(assetManager, inputManager, audioRenderer, vp); this.renderDev = new RenderDeviceJme(this); this.batchRendererBackend = null; nifty = new Nifty(renderDev, soundDev, inputSys, new AccurateTimeProvider()); inputSys.setNifty(nifty); resourceLocation = new ResourceLocationJme(); nifty.getResourceLoader().removeAllResourceLocations(); nifty.getResourceLoader().addResourceLocation(resourceLocation); }
/** * Invoked when the event is started. */ @Override public void onPlay() { log.log(Level.FINEST, "screen should be {0}", screen); nifty.gotoScreen(screen); }
@Override public void onStop() { if (nifty.getCurrentScreen() != null) { nifty.getCurrentScreen().endScreen(null); } }
@NiftyEventSubscriber(id="PlatformListBox") public void onPlatformChanged(String id, ListBoxSelectionChangedEvent<String> event) { String p = event.getSelection().isEmpty() ? null : event.getSelection().get(0); LOG.log(Level.INFO, "Selected platform changed to {0}", p); selectedPlatform = p; changePlatform(p); }
@Override public void simpleInitApp() { clContext = null; NiftyJmeDisplay niftyDisplay = NiftyJmeDisplay.newNiftyJmeDisplay( assetManager, inputManager, audioRenderer, guiViewPort); nifty = niftyDisplay.getNifty(); nifty.fromXml("jme3test/opencl/ContextSwitchingScreen.xml", "Screen", this); guiViewPort.addProcessor(niftyDisplay); inputManager.setCursorVisible(true); flyCam.setEnabled(false); }
@Override public void onPlay() { System.out.println("screen should be " + screen); nifty.gotoScreen(screen); }
@Override public void initialize(){ super.initialize(); System.out.println("Initialize"); RootNodeState state = new RootNodeState(); viewPort.attachScene(state.getRootNode()); stateManager.attach(state); Spatial model = assetManager.loadModel("Models/Teapot/Teapot.obj"); model.scale(3); model.setMaterial(assetManager.loadMaterial("Interface/Logo/Logo.j3m")); state.getRootNode().attachChild(model); NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort); niftyDisplay.getNifty().fromXml("Interface/Nifty/HelloJme.xml", "start"); guiViewPort.addProcessor(niftyDisplay); }