use of com.jme3.input.controls.KeyTrigger in project jmonkeyengine by jMonkeyEngine.
the class WorldOfInception method setupKeys.
private void setupKeys() {
inputManager.addMapping("StrafeLeft", new KeyTrigger(KeyInput.KEY_A));
inputManager.addMapping("StrafeRight", new KeyTrigger(KeyInput.KEY_D));
inputManager.addMapping("Forward", new KeyTrigger(KeyInput.KEY_W));
inputManager.addMapping("Back", new KeyTrigger(KeyInput.KEY_S));
inputManager.addMapping("StrafeUp", new KeyTrigger(KeyInput.KEY_Q));
inputManager.addMapping("StrafeDown", new KeyTrigger(KeyInput.KEY_Z), new KeyTrigger(KeyInput.KEY_Y));
inputManager.addMapping("Space", new KeyTrigger(KeyInput.KEY_SPACE));
inputManager.addMapping("Return", new KeyTrigger(KeyInput.KEY_RETURN));
inputManager.addMapping("Esc", new KeyTrigger(KeyInput.KEY_ESCAPE));
inputManager.addMapping("Up", new KeyTrigger(KeyInput.KEY_UP));
inputManager.addMapping("Down", new KeyTrigger(KeyInput.KEY_DOWN));
inputManager.addMapping("Left", new KeyTrigger(KeyInput.KEY_LEFT));
inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_RIGHT));
inputManager.addListener(this, "StrafeLeft", "StrafeRight", "Forward", "Back", "StrafeUp", "StrafeDown", "Space", "Reset", "Esc", "Up", "Down", "Left", "Right");
}
use of com.jme3.input.controls.KeyTrigger in project jmonkeyengine by jMonkeyEngine.
the class TestTriangleCollision method simpleInitApp.
@Override
public void simpleInitApp() {
// Create two boxes
Mesh mesh1 = new Box(0.5f, 0.5f, 0.5f);
geom1 = new Geometry("Box", mesh1);
geom1.move(2, 2, -.5f);
Material m1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
m1.setColor("Color", ColorRGBA.Blue);
geom1.setMaterial(m1);
rootNode.attachChild(geom1);
// load a character from jme3test-test-data
golem = assetManager.loadModel("Models/Oto/Oto.mesh.xml");
golem.scale(0.5f);
golem.setLocalTranslation(-1.0f, -1.5f, -0.6f);
// We must add a light to make the model visible
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal());
golem.addLight(sun);
rootNode.attachChild(golem);
// Create input
inputManager.addMapping("MoveRight", new KeyTrigger(KeyInput.KEY_L));
inputManager.addMapping("MoveLeft", new KeyTrigger(KeyInput.KEY_J));
inputManager.addMapping("MoveUp", new KeyTrigger(KeyInput.KEY_I));
inputManager.addMapping("MoveDown", new KeyTrigger(KeyInput.KEY_K));
inputManager.addListener(analogListener, new String[] { "MoveRight", "MoveLeft", "MoveUp", "MoveDown" });
}
use of com.jme3.input.controls.KeyTrigger in project jmonkeyengine by jMonkeyEngine.
the class TestMovingParticle method simpleInitApp.
@Override
public void simpleInitApp() {
emit = new ParticleEmitter("Emitter", Type.Triangle, 300);
emit.setGravity(0, 0, 0);
emit.setVelocityVariation(1);
emit.setLowLife(1);
emit.setHighLife(1);
emit.setInitialVelocity(new Vector3f(0, .5f, 0));
emit.setImagesX(15);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
mat.setTexture("Texture", assetManager.loadTexture("Effects/Smoke/Smoke.png"));
emit.setMaterial(mat);
rootNode.attachChild(emit);
inputManager.addListener(new ActionListener() {
public void onAction(String name, boolean isPressed, float tpf) {
if ("setNum".equals(name) && isPressed) {
emit.setNumParticles(1000);
}
}
}, "setNum");
inputManager.addMapping("setNum", new KeyTrigger(KeyInput.KEY_SPACE));
}
use of com.jme3.input.controls.KeyTrigger in project jmonkeyengine by jMonkeyEngine.
the class TestPointSprite method simpleInitApp.
@Override
public void simpleInitApp() {
final ParticleEmitter emit = new ParticleEmitter("Emitter", Type.Point, 10000);
emit.setShape(new EmitterBoxShape(new Vector3f(-1.8f, -1.8f, -1.8f), new Vector3f(1.8f, 1.8f, 1.8f)));
emit.setGravity(0, 0, 0);
emit.setLowLife(60);
emit.setHighLife(60);
emit.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 0, 0));
emit.setImagesX(15);
emit.setStartSize(0.05f);
emit.setEndSize(0.05f);
emit.setStartColor(ColorRGBA.White);
emit.setEndColor(ColorRGBA.White);
emit.setSelectRandomImage(true);
emit.emitAllParticles();
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
mat.setBoolean("PointSprite", true);
mat.setTexture("Texture", assetManager.loadTexture("Effects/Smoke/Smoke.png"));
emit.setMaterial(mat);
rootNode.attachChild(emit);
inputManager.addListener(new ActionListener() {
public void onAction(String name, boolean isPressed, float tpf) {
if ("setNum".equals(name) && isPressed) {
emit.setNumParticles(5000);
emit.emitAllParticles();
}
}
}, "setNum");
inputManager.addMapping("setNum", new KeyTrigger(KeyInput.KEY_SPACE));
}
use of com.jme3.input.controls.KeyTrigger in project jmonkeyengine by jMonkeyEngine.
the class TestQ3 method setupKeys.
private void setupKeys() {
inputManager.addMapping("Lefts", new KeyTrigger(KeyInput.KEY_A));
inputManager.addMapping("Rights", new KeyTrigger(KeyInput.KEY_D));
inputManager.addMapping("Ups", new KeyTrigger(KeyInput.KEY_W));
inputManager.addMapping("Downs", new KeyTrigger(KeyInput.KEY_S));
inputManager.addMapping("Space", new KeyTrigger(KeyInput.KEY_SPACE));
inputManager.addListener(this, "Lefts");
inputManager.addListener(this, "Rights");
inputManager.addListener(this, "Ups");
inputManager.addListener(this, "Downs");
inputManager.addListener(this, "Space");
}
Aggregations