use of com.jme3.input.controls.KeyTrigger in project jmonkeyengine by jMonkeyEngine.
the class TestParallelProjection method simpleInitApp.
public void simpleInitApp() {
Geometry teaGeom = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj");
DirectionalLight dl = new DirectionalLight();
dl.setColor(ColorRGBA.White);
dl.setDirection(Vector3f.UNIT_XYZ.negate());
rootNode.addLight(dl);
rootNode.attachChild(teaGeom);
// Setup first view
cam.setParallelProjection(true);
float aspect = (float) cam.getWidth() / cam.getHeight();
cam.setFrustum(-1000, 1000, -aspect * frustumSize, aspect * frustumSize, frustumSize, -frustumSize);
inputManager.addListener(this, "Size+", "Size-");
inputManager.addMapping("Size+", new KeyTrigger(KeyInput.KEY_W));
inputManager.addMapping("Size-", new KeyTrigger(KeyInput.KEY_S));
}
use of com.jme3.input.controls.KeyTrigger in project jmonkeyengine by jMonkeyEngine.
the class TestPostWaterLake method simpleInitApp.
public void simpleInitApp() {
this.flyCam.setMoveSpeed(10);
cam.setLocation(new Vector3f(-27.0f, 1.0f, 75.0f));
// cam.setRotation(new Quaternion(0.03f, 0.9f, 0f, 0.4f));
// load sky
rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
File file = new File("wildhouse.zip");
if (file.exists()) {
useHttp = false;
}
// load the level from zip or http zip
if (useHttp) {
assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip", HttpZipLocator.class);
} else {
assetManager.registerLocator("wildhouse.zip", ZipLocator.class);
}
Spatial scene = assetManager.loadModel("main.scene");
rootNode.attachChild(scene);
DirectionalLight sun = new DirectionalLight();
Vector3f lightDir = new Vector3f(-0.37352666f, -0.50444174f, -0.7784704f);
sun.setDirection(lightDir);
sun.setColor(ColorRGBA.White.clone().multLocal(2));
scene.addLight(sun);
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
final WaterFilter water = new WaterFilter(rootNode, lightDir);
water.setWaterHeight(-20);
water.setUseFoam(false);
water.setUseRipples(false);
water.setDeepWaterColor(ColorRGBA.Brown);
water.setWaterColor(ColorRGBA.Brown.mult(2.0f));
water.setWaterTransparency(0.2f);
water.setMaxAmplitude(0.3f);
water.setWaveScale(0.008f);
water.setSpeed(0.7f);
water.setShoreHardness(1.0f);
water.setRefractionConstant(0.2f);
water.setShininess(0.3f);
water.setSunScale(1.0f);
water.setColorExtinction(new Vector3f(10.0f, 20.0f, 30.0f));
fpp.addFilter(water);
viewPort.addProcessor(fpp);
inputManager.addListener(new ActionListener() {
public void onAction(String name, boolean isPressed, float tpf) {
if (isPressed) {
if (water.isUseHQShoreline()) {
water.setUseHQShoreline(false);
} else {
water.setUseHQShoreline(true);
}
}
}
}, "HQ");
inputManager.addMapping("HQ", new KeyTrigger(keyInput.KEY_SPACE));
}
use of com.jme3.input.controls.KeyTrigger in project jmonkeyengine by jMonkeyEngine.
the class TerrainGridSerializationTest method initKeys.
private void initKeys() {
// You can map one or several inputs to one named action
this.inputManager.addMapping("Lefts", new KeyTrigger(KeyInput.KEY_A));
this.inputManager.addMapping("Rights", new KeyTrigger(KeyInput.KEY_D));
this.inputManager.addMapping("Ups", new KeyTrigger(KeyInput.KEY_W));
this.inputManager.addMapping("Downs", new KeyTrigger(KeyInput.KEY_S));
this.inputManager.addMapping("Jumps", new KeyTrigger(KeyInput.KEY_SPACE));
this.inputManager.addListener(this.actionListener, "Lefts");
this.inputManager.addListener(this.actionListener, "Rights");
this.inputManager.addListener(this.actionListener, "Ups");
this.inputManager.addListener(this.actionListener, "Downs");
this.inputManager.addListener(this.actionListener, "Jumps");
}
use of com.jme3.input.controls.KeyTrigger in project jmonkeyengine by jMonkeyEngine.
the class TerrainGridTest method initKeys.
private void initKeys() {
// You can map one or several inputs to one named action
this.inputManager.addMapping("Lefts", new KeyTrigger(KeyInput.KEY_A));
this.inputManager.addMapping("Rights", new KeyTrigger(KeyInput.KEY_D));
this.inputManager.addMapping("Ups", new KeyTrigger(KeyInput.KEY_W));
this.inputManager.addMapping("Downs", new KeyTrigger(KeyInput.KEY_S));
this.inputManager.addMapping("Jumps", new KeyTrigger(KeyInput.KEY_SPACE));
this.inputManager.addListener(this.actionListener, "Lefts");
this.inputManager.addListener(this.actionListener, "Rights");
this.inputManager.addListener(this.actionListener, "Ups");
this.inputManager.addListener(this.actionListener, "Downs");
this.inputManager.addListener(this.actionListener, "Jumps");
}
use of com.jme3.input.controls.KeyTrigger in project jmonkeyengine by jMonkeyEngine.
the class TestSimpleWater method initInput.
protected void initInput() {
flyCam.setMoveSpeed(3);
//init input
inputManager.addMapping("use_water", new KeyTrigger(KeyInput.KEY_O));
inputManager.addListener(this, "use_water");
inputManager.addMapping("lightup", new KeyTrigger(KeyInput.KEY_T));
inputManager.addListener(this, "lightup");
inputManager.addMapping("lightdown", new KeyTrigger(KeyInput.KEY_G));
inputManager.addListener(this, "lightdown");
inputManager.addMapping("lightleft", new KeyTrigger(KeyInput.KEY_H));
inputManager.addListener(this, "lightleft");
inputManager.addMapping("lightright", new KeyTrigger(KeyInput.KEY_K));
inputManager.addListener(this, "lightright");
inputManager.addMapping("lightforward", new KeyTrigger(KeyInput.KEY_U));
inputManager.addListener(this, "lightforward");
inputManager.addMapping("lightback", new KeyTrigger(KeyInput.KEY_J));
inputManager.addListener(this, "lightback");
}
Aggregations