@Override public void initialize(AppStateManager stateManager, Application app) { super.initialize(stateManager, app); this.app = app; if (app.getInputManager() != null) { if (flyCam == null) { flyCam = new FlyByCamera(app.getCamera()); } flyCam.registerWithInput(app.getInputManager()); } }
@Override public void cleanup() { super.cleanup(); if (app.getInputManager() != null) { flyCam.unregisterInput(); } }
app.getInputManager().addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); app.getInputManager().addListener(actionListener, "shoot");
@Override public Vector2f getCursorPosition() { if (environment != null){ if (environment.getApplication() != null){ if( environment.isInVR() ) { return cursorPos; } return environment.getApplication().getInputManager().getCursorPosition(); } else { throw new IllegalStateException("This VR environment is not attached to any application."); } } else { throw new IllegalStateException("This VR view manager is not attached to any VR environment."); } }
@Override public void onAction(String name, boolean isPressed, float tpf) { if (name.equals(TOGGLE_KEY) && isPressed) { setEnabled(!isEnabled()); } if (isEnabled() && name.equals(CLICK_KEY) && isPressed) { handleClick(getApplication().getInputManager().getCursorPosition()); } } }
@Override protected void cleanup( Application app ) { InputManager inputManager = app.getInputManager(); if( inputManager.hasMapping(INPUT_MAPPING_PROFILER_TOGGLE) ) { inputManager.deleteMapping(INPUT_MAPPING_PROFILER_TOGGLE); } inputManager.removeListener(keyListener); }
@Override public void initialize(AppStateManager stateManager, Application app) { super.initialize(stateManager, app); this.app = app; this.inputManager = app.getInputManager(); if (app.getInputManager() != null) { inputManager.addMapping(INPUT_MAPPING_CAMERA_POS, new KeyTrigger(KeyInput.KEY_C)); inputManager.addMapping(INPUT_MAPPING_MEMORY, new KeyTrigger(KeyInput.KEY_M)); inputManager.addListener(keyListener, INPUT_MAPPING_CAMERA_POS, INPUT_MAPPING_MEMORY); } }
@Override public void initialize(AppStateManager stateManager, Application app) { if (!super.isInitialized()){ InputManager inputManager = app.getInputManager(); inputManager.addMapping("ScreenShot", new KeyTrigger(KeyInput.KEY_SYSRQ)); inputManager.addListener(this, "ScreenShot"); List<ViewPort> vps = app.getRenderManager().getPostViews(); ViewPort last = vps.get(vps.size()-1); last.addProcessor(this); if (shotName == null) { shotName = app.getClass().getSimpleName(); } } super.initialize(stateManager, app); }
@Override public void initialize(AppStateManager stateManager, Application app) { renderManager = app.getRenderManager(); assetManager = app.getAssetManager(); inputManager = app.getInputManager(); for (Binding binding : bindings) { bind(binding); } super.initialize(stateManager, app); }
@Override protected void cleanup(Application app) { ui.detachAllChildren(); InputManager manager = getApplication().getInputManager(); manager.deleteMapping(TOGGLE_KEY); manager.deleteMapping(CLICK_KEY); manager.removeListener(inputListener); }
Vector2f click2d = app.getInputManager().getCursorPosition(); CollisionResults results = new CollisionResults();
@Override protected void initialize(Application app) { vp = app.getRenderManager().createMainView("debug", app.getCamera()); vp.attachScene(debugNode); vp.setClearDepth(true); this.app = app; for (ArmatureDebugger armatureDebugger : armatures.values()) { armatureDebugger.initialize(app.getAssetManager(), app.getCamera()); } app.getInputManager().addListener(actionListener, "shoot", "toggleJoints"); app.getInputManager().addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT), new MouseButtonTrigger(MouseInput.BUTTON_RIGHT)); app.getInputManager().addMapping("toggleJoints", new KeyTrigger(KeyInput.KEY_F10)); debugNode.addLight(new DirectionalLight(new Vector3f(-1f, -1f, -1f).normalizeLocal())); debugNode.addLight(new DirectionalLight(new Vector3f(1f, 1f, 1f).normalizeLocal(), new ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f))); vp.setEnabled(false); }
if( getVREnvironment().getApplication().getInputManager().isCursorVisible() ) { int index = (avgCounter+1) % AVERAGE_AMNT; lastXmv[index] = Xamount * 133f;
@Override public void initialize(AppStateManager stateManager, Application app) { super.initialize(stateManager, app); this.inputManager = app.getInputManager(); target = new Node("ChaseCamTarget"); camNode.setCamera(app.getCamera()); camNode.setControlDir(CameraControl.ControlDirection.SpatialToCamera); target.attachChild(camNode); camNode.setLocalTranslation(0, 0, distance); upVector = app.getCamera().getUp().clone(); leftVector = app.getCamera().getLeft().clone(); registerWithInput(); rotateCamera(); }
if( getVREnvironment().getApplication().getInputManager().isCursorVisible() ) { int index = (avgCounter+1) % AVERAGE_AMNT; lastXmv[index] = Xamount * 133f;
if( getVREnvironment().getApplication().getInputManager().isCursorVisible() ) { int index = (avgCounter+1) % AVERAGE_AMNT; lastXmv[index] = Xamount * 133f;
if( getVREnvironment().getApplication().getInputManager().isCursorVisible() ) { int index = (avgCounter+1) % AVERAGE_AMNT; lastXmv[index] = Xamount * 133f;
@Override protected void initialize( Application app ) { graph = new Geometry("profiler", profiler.getMesh()); Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); mat.setBoolean("VertexColor", true); graph.setMaterial(mat); graph.setLocalTranslation(0, 300, 0); graph.setLocalScale(1, scale, 1); Mesh mesh = new Mesh(); background = new Geometry("profiler.background", mesh); mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); mat.setBoolean("VertexColor", true); mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); background.setMaterial(mat); background.setLocalTranslation(0, 300, -1); background.setLocalScale(1, scale, 1); refreshBackground(); InputManager inputManager = app.getInputManager(); if( inputManager != null ) { inputManager.addMapping(INPUT_MAPPING_PROFILER_TOGGLE, new KeyTrigger(KeyInput.KEY_F6)); inputManager.addListener(keyListener, INPUT_MAPPING_PROFILER_TOGGLE); } }
if( environment.getApplication().getInputManager().isCursorVisible() ) { if( mouseImage.getParent() == null ) {
ui.attachChild(hideInsignificantField); final InputManager inputManager = app.getInputManager(); if (inputManager != null) { inputManager.addMapping(TOGGLE_KEY, new KeyTrigger(KeyInput.KEY_F6));