private void setupKeyBindings() { KeyBindingManager.getKeyBindingManager().set("g", KeyInput.KEY_G); sheepDebugText = Text.createDefaultTextLabel("Text", "hest"); sheepDebugText.setRenderQueueMode(Renderer.QUEUE_ORTHO); sheepDebugText.setLightCombineMode(Spatial.LightCombineMode.Off); sheepDebugText.setLocalTranslation(new Vector3f(0, 20, 1)); statNode.attachChild(sheepDebugText); }
protected void simpleInitGame() { // Setup camera cam.setFrustumPerspective( 55.0f, (float) display.getWidth() / (float) display.getHeight(), 1, 1000); // Setup lights PointLight light = new PointLight(); light.setDiffuse(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f)); light.setAmbient(new ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f)); light.setLocation(new Vector3f(0, 30, 0)); light.setEnabled(true); lightState.attach(light); // Add dummy objects to rootNode rootNode.attachChild(createObjects()); try { MaxToJme C1 = new MaxToJme(); ByteArrayOutputStream BO = new ByteArrayOutputStream(); URL maxFile = TestMaxJmeWrite.class.getClassLoader().getResource("jmetest/data/model/Character.3DS"); C1.convert(new BufferedInputStream(maxFile.openStream()), BO); Node r = (Node) BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray())); r.setLocalScale(.1f); if (r.getChild(0).getControllers().size() != 0) r.getChild(0).getController(0).setSpeed(20); Quaternion temp = new Quaternion(); temp.fromAngleAxis(FastMath.PI / 2, new Vector3f(-1, 0, 0)); r.setLocalRotation(temp); r.setLocalTranslation(new Vector3f(0, 3, 0)); rootNode.attachChild(r); } catch (IOException e) { logger.log(Level.SEVERE, "Error loading max file", e); } // Setup renderpasses RenderPass rootPass = new RenderPass(); rootPass.add(rootNode); pManager.add(rootPass); sketchRenderPass = new SketchRenderPass(cam, 2); if (!sketchRenderPass.isSupported()) { Text t = new Text("Text", "GLSL Not supported on this computer."); t.setRenderQueueMode(Renderer.QUEUE_ORTHO); t.setLightCombineMode(LightState.OFF); t.setLocalTranslation(new Vector3f(0, 20, 0)); fpsNode.attachChild(t); } else { sketchRenderPass.add(rootNode); pManager.add(sketchRenderPass); } if (!sketchRenderPass.isSupported()) { Text t = new Text("Text", "GLSL Not supported on this computer."); t.setRenderQueueMode(Renderer.QUEUE_ORTHO); t.setLightCombineMode(LightState.OFF); t.setLocalTranslation(new Vector3f(0, 20, 0)); fpsNode.attachChild(t); } RenderPass fpsPass = new RenderPass(); fpsPass.add(fpsNode); pManager.add(fpsPass); // Initialize keybindings KeyBindingManager.getKeyBindingManager().set("1", KeyInput.KEY_1); KeyBindingManager.getKeyBindingManager().set("2", KeyInput.KEY_2); KeyBindingManager.getKeyBindingManager().set("3", KeyInput.KEY_3); KeyBindingManager.getKeyBindingManager().set("4", KeyInput.KEY_4); KeyBindingManager.getKeyBindingManager().set("5", KeyInput.KEY_5); KeyBindingManager.getKeyBindingManager().set("6", KeyInput.KEY_6); KeyBindingManager.getKeyBindingManager().set("7", KeyInput.KEY_7); KeyBindingManager.getKeyBindingManager().set("8", KeyInput.KEY_8); KeyBindingManager.getKeyBindingManager().set("9", KeyInput.KEY_9); KeyBindingManager.getKeyBindingManager().set("0", KeyInput.KEY_0); KeyBindingManager.getKeyBindingManager().set("y", KeyInput.KEY_Y); KeyBindingManager.getKeyBindingManager().set("h", KeyInput.KEY_H); KeyBindingManager.getKeyBindingManager().set("shot", KeyInput.KEY_F4); }