Java Code Examples for com.jme3.niftygui.NiftyJmeDisplay#getNifty()
The following examples show how to use
com.jme3.niftygui.NiftyJmeDisplay#getNifty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestIssue99.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { /* * GUI requires a cursor; prevent flyCam from hiding it. */ flyCam.setDragToRotate(true); /* * Start NiftyGUI without the batched renderer. */ NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay( assetManager, inputManager, audioRenderer, guiViewPort); guiViewPort.addProcessor(niftyDisplay); /* * Load GUI controls, styles, and layout from XML assets. */ Nifty nifty = niftyDisplay.getNifty(); nifty.loadControlFile("nifty-default-controls.xml"); nifty.loadStyleFile("nifty-default-styles.xml"); nifty.fromXml("Interface/Nifty/test-issue-99.xml", "test-issue-99", this); }
Example 2
Source File: TestNiftyGui.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg")); geom.setMaterial(mat); rootNode.attachChild(geom); NiftyJmeDisplay niftyDisplay = NiftyJmeDisplay.newNiftyJmeDisplay( assetManager, inputManager, audioRenderer, guiViewPort); nifty = niftyDisplay.getNifty(); nifty.fromXml("Interface/Nifty/HelloJme.xml", "start", this); // attach the nifty display to the gui view port as a processor guiViewPort.addProcessor(niftyDisplay); // disable the fly cam // flyCam.setEnabled(false); // flyCam.setDragToRotate(true); inputManager.setCursorVisible(true); }
Example 3
Source File: TestNiftyExamples.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override 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); }
Example 4
Source File: TestContextSwitching.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@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); }
Example 5
Source File: TestNiftyGui.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void simpleInitApp() { Box b = new Box(Vector3f.ZERO, 1, 1, 1); Geometry geom = new Geometry("Box", b); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg")); geom.setMaterial(mat); rootNode.attachChild(geom); NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort); nifty = niftyDisplay.getNifty(); nifty.fromXml("Interface/Nifty/HelloJme.xml", "start", this); // attach the nifty display to the gui view port as a processor guiViewPort.addProcessor(niftyDisplay); // disable the fly cam // flyCam.setEnabled(false); // flyCam.setDragToRotate(true); inputManager.setCursorVisible(true); }
Example 6
Source File: Cinematic.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void initialize(AppStateManager stateManager, Application app) { if (niftyXmlPath != null) { NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(app.getAssetManager(), app.getInputManager(), app.getAudioRenderer(), app.getGuiViewPort()); nifty = niftyDisplay.getNifty(); nifty.fromXmlWithoutStartScreen(niftyXmlPath); app.getGuiViewPort().addProcessor(niftyDisplay); } initEvent(app, this); for (CinematicEvent cinematicEvent : cinematicEvents) { cinematicEvent.initEvent(app, this); } initialized = true; }
Example 7
Source File: TestNiftyToMesh.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { ViewPort niftyView = renderManager.createPreView("NiftyView", new Camera(1024, 768)); niftyView.setClearFlags(true, true, true); NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, niftyView); nifty = niftyDisplay.getNifty(); nifty.fromXml("all/intro.xml", "start"); niftyView.addProcessor(niftyDisplay); Texture2D depthTex = new Texture2D(1024, 768, Format.Depth); FrameBuffer fb = new FrameBuffer(1024, 768, 1); fb.setDepthTexture(depthTex); Texture2D tex = new Texture2D(1024, 768, Format.RGBA8); tex.setMinFilter(MinFilter.Trilinear); tex.setMagFilter(MagFilter.Bilinear); fb.setColorTexture(tex); niftyView.setClearFlags(true, true, true); niftyView.setOutputFrameBuffer(fb); Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", tex); geom.setMaterial(mat); rootNode.attachChild(geom); }
Example 8
Source File: Game.java From OpenRTS with MIT License | 5 votes |
@Override public void simpleInitApp() { BulletAppState bulletAppState = new BulletAppState(); stateManager.attach(bulletAppState); bulletAppState.getPhysicsSpace().setGravity(new Vector3f(0, 0, -1)); // stateManager.detach(bulletAppState); flyCam.setUpVector(new Vector3f(0, 0, 1)); flyCam.setEnabled(false); MaterialManager.setAssetManager(assetManager); MapView view = new MapView(rootNode, guiNode, bulletAppState.getPhysicsSpace(), assetManager, viewPort); NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort); BattlefieldController fieldCtrl = new BattlefieldController(view, niftyDisplay.getNifty(), inputManager, cam); niftyDisplay.getNifty().setIgnoreKeyboardEvents(true); // TODO: validation is needed to be sure everyting in XML is fine. see http://wiki.jmonkeyengine.org/doku.php/jme3:advanced:nifty_gui_best_practices // niftyDisplay.getNifty().validateXml("interface/screen.xml"); niftyDisplay.getNifty().fromXml("interface/screen.xml", "editor"); stateManager.attach(fieldCtrl); fieldCtrl.setEnabled(true); ModelManager.setNewBattlefield(); guiViewPort.addProcessor(niftyDisplay); }
Example 9
Source File: Editor.java From OpenRTS with MIT License | 5 votes |
@Override public void simpleInitApp() { BulletAppState bulletAppState = new BulletAppState(); stateManager.attach(bulletAppState); bulletAppState.getPhysicsSpace().setGravity(new Vector3f(0, 0, -1)); // stateManager.detach(bulletAppState); flyCam.setUpVector(new Vector3f(0, 0, 1)); flyCam.setEnabled(false); EditorView view = new EditorView(rootNode, guiNode, bulletAppState.getPhysicsSpace(), assetManager, viewPort); NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort); EditorController editorCtrl = new EditorController(view, niftyDisplay.getNifty(), inputManager, cam); niftyDisplay.getNifty().setIgnoreKeyboardEvents(true); // TODO: validation is needed to be sure everyting in XML is fine. see http://wiki.jmonkeyengine.org/doku.php/jme3:advanced:nifty_gui_best_practices // niftyDisplay.getNifty().validateXml("interface/screen.xml"); niftyDisplay.getNifty().fromXml("interface/screen.xml", "editor"); stateManager.attach(editorCtrl); editorCtrl.setEnabled(true); ModelManager.setNewBattlefield(); guiViewPort.addProcessor(niftyDisplay); }
Example 10
Source File: GameMutliplayer.java From OpenRTS with MIT License | 5 votes |
@Override public void simpleInitApp() { BulletAppState bulletAppState = new BulletAppState(); stateManager.attach(bulletAppState); bulletAppState.getPhysicsSpace().setGravity(new Vector3f(0, 0, -1)); // stateManager.detach(bulletAppState); flyCam.setUpVector(new Vector3f(0, 0, 1)); flyCam.setEnabled(false); EditorView view = new EditorView(rootNode, guiNode, bulletAppState.getPhysicsSpace(), assetManager, viewPort); NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort); BattlefieldController fieldCtrl = new BattlefieldController(view, niftyDisplay.getNifty(), inputManager, cam); niftyDisplay.getNifty().setIgnoreKeyboardEvents(true); // TODO: validation is needed to be sure everyting in XML is fine. see http://wiki.jmonkeyengine.org/doku.php/jme3:advanced:nifty_gui_best_practices // niftyDisplay.getNifty().validateXml("interface/screen.xml"); niftyDisplay.getNifty().fromXml("interface/screen.xml", "hud"); stateManager.attach(fieldCtrl); fieldCtrl.setEnabled(true); guiViewPort.addProcessor(niftyDisplay); if (!mapfilename.isEmpty()) { ModelManager.loadBattlefield(mapfilename); } else { ModelManager.setNewBattlefield(); } }
Example 11
Source File: Game.java From OpenRTS with MIT License | 5 votes |
@Override public void simpleInitApp() { BulletAppState bulletAppState = new BulletAppState(); stateManager.attach(bulletAppState); bulletAppState.getPhysicsSpace().setGravity(new Vector3f(0, 0, -1)); // stateManager.detach(bulletAppState); flyCam.setUpVector(new Vector3f(0, 0, 1)); flyCam.setEnabled(false); view = new MapView(rootNode, guiNode, bulletAppState.getPhysicsSpace(), assetManager, viewPort); NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort); fieldCtrl = new BattlefieldController(view, niftyDisplay.getNifty(), inputManager, cam); EventManager.register(this); niftyDisplay.getNifty().setIgnoreKeyboardEvents(true); // TODO: validation is needed to be sure everyting in XML is fine. see http://wiki.jmonkeyengine.org/doku.php/jme3:advanced:nifty_gui_best_practices // niftyDisplay.getNifty().validateXml("interface/screen.xml"); niftyDisplay.getNifty().fromXml("interface/screen.xml", "hud"); stateManager.attach(fieldCtrl); fieldCtrl.setEnabled(true); if (view.getMapRend() != null) { view.getMapRend().renderTiles(); } guiViewPort.addProcessor(niftyDisplay); }
Example 12
Source File: MainRTS.java From OpenRTS with MIT License | 5 votes |
@Override public void simpleInitApp() { bulletAppState = new BulletAppState(); stateManager.attach(bulletAppState); bulletAppState.getPhysicsSpace().setGravity(new Vector3f(0, 0, -1)); // stateManager.detach(bulletAppState); flyCam.setUpVector(new Vector3f(0, 0, 1)); flyCam.setEnabled(false); MaterialManager.setAssetManager(assetManager); view = new EditorView(rootNode, guiNode, bulletAppState.getPhysicsSpace(), assetManager, viewPort); NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort); fieldCtrl = new BattlefieldController(view, niftyDisplay.getNifty(), inputManager, cam); editorCtrl = new EditorController(view, niftyDisplay.getNifty(), inputManager, cam); groundCtrl = new GroundController(view, niftyDisplay.getNifty(), inputManager, cam); EventManager.register(this); niftyDisplay.getNifty().setIgnoreKeyboardEvents(true); // TODO: validation is needed to be sure everyting in XML is fine. see http://wiki.jmonkeyengine.org/doku.php/jme3:advanced:nifty_gui_best_practices // niftyDisplay.getNifty().validateXml("interface/screen.xml"); niftyDisplay.getNifty().fromXml("interface/screen.xml", "editor"); actualCtrl = editorCtrl; stateManager.attach(actualCtrl); actualCtrl.setEnabled(true); guiViewPort.addProcessor(niftyDisplay); CollisionTester.setAssetManager(assetManager); CollisionTester.root = rootNode; ModelManager.setNewBattlefield(); }
Example 13
Source File: TestNiftyExamples.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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); }
Example 14
Source File: TestNiftyToMesh.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void simpleInitApp() { ViewPort niftyView = renderManager.createPreView("NiftyView", new Camera(1024, 768)); niftyView.setClearFlags(true, true, true); NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, niftyView); nifty = niftyDisplay.getNifty(); nifty.fromXml("all/intro.xml", "start"); niftyView.addProcessor(niftyDisplay); Texture2D depthTex = new Texture2D(1024, 768, Format.Depth); FrameBuffer fb = new FrameBuffer(1024, 768, 1); fb.setDepthTexture(depthTex); Texture2D tex = new Texture2D(1024, 768, Format.RGBA8); tex.setMinFilter(MinFilter.Trilinear); tex.setMagFilter(MagFilter.Bilinear); fb.setColorTexture(tex); niftyView.setClearFlags(true, true, true); niftyView.setOutputFrameBuffer(fb); Box b = new Box(Vector3f.ZERO, 1, 1, 1); Geometry geom = new Geometry("Box", b); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", tex); geom.setMaterial(mat); rootNode.attachChild(geom); }