Search in sources :

Example 21 with MouseButtonTrigger

use of com.jme3.input.controls.MouseButtonTrigger in project jmonkeyengine by jMonkeyEngine.

the class TestWriteToTexture method simpleInitApp.

@Override
public void simpleInitApp() {
    initOpenCL1();
    tex = new Texture2D(settings.getWidth(), settings.getHeight(), 1, com.jme3.texture.Image.Format.RGBA8);
    Picture pic = new Picture("julia");
    pic.setTexture(assetManager, tex, true);
    pic.setPosition(0, 0);
    pic.setWidth(settings.getWidth());
    pic.setHeight(settings.getHeight());
    guiNode.attachChild(pic);
    initCounter = 0;
    flyCam.setEnabled(false);
    inputManager.setCursorVisible(true);
    inputManager.addMapping("right", new MouseAxisTrigger(MouseInput.AXIS_X, false));
    inputManager.addMapping("left", new MouseAxisTrigger(MouseInput.AXIS_X, true));
    inputManager.addMapping("up", new MouseAxisTrigger(MouseInput.AXIS_Y, false));
    inputManager.addMapping("down", new MouseAxisTrigger(MouseInput.AXIS_Y, true));
    inputManager.addMapping("drag", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addListener(this, "right", "left", "up", "down", "drag");
    dragging = false;
}
Also used : Texture2D(com.jme3.texture.Texture2D) Picture(com.jme3.ui.Picture) MouseAxisTrigger(com.jme3.input.controls.MouseAxisTrigger) MouseButtonTrigger(com.jme3.input.controls.MouseButtonTrigger)

Example 22 with MouseButtonTrigger

use of com.jme3.input.controls.MouseButtonTrigger in project jmonkeyengine by jMonkeyEngine.

the class TerrainGridTileLoaderTest 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.addMapping("pick", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    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");
    this.inputManager.addListener(this.actionListener, "pick");
}
Also used : KeyTrigger(com.jme3.input.controls.KeyTrigger) MouseButtonTrigger(com.jme3.input.controls.MouseButtonTrigger)

Example 23 with MouseButtonTrigger

use of com.jme3.input.controls.MouseButtonTrigger in project jmonkeyengine by jMonkeyEngine.

the class TerrainTestCollision method setupKeys.

private void setupKeys() {
    flyCam.setMoveSpeed(50);
    inputManager.addMapping("wireframe", new KeyTrigger(KeyInput.KEY_T));
    inputManager.addListener(actionListener, "wireframe");
    inputManager.addMapping("Lefts", new KeyTrigger(KeyInput.KEY_H));
    inputManager.addMapping("Rights", new KeyTrigger(KeyInput.KEY_K));
    inputManager.addMapping("Ups", new KeyTrigger(KeyInput.KEY_U));
    inputManager.addMapping("Downs", new KeyTrigger(KeyInput.KEY_J));
    inputManager.addMapping("Forwards", new KeyTrigger(KeyInput.KEY_Y));
    inputManager.addMapping("Backs", new KeyTrigger(KeyInput.KEY_I));
    inputManager.addListener(actionListener, "Lefts");
    inputManager.addListener(actionListener, "Rights");
    inputManager.addListener(actionListener, "Ups");
    inputManager.addListener(actionListener, "Downs");
    inputManager.addListener(actionListener, "Forwards");
    inputManager.addListener(actionListener, "Backs");
    inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addListener(actionListener, "shoot");
    inputManager.addMapping("cameraDown", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
    inputManager.addListener(actionListener, "cameraDown");
}
Also used : KeyTrigger(com.jme3.input.controls.KeyTrigger) MouseButtonTrigger(com.jme3.input.controls.MouseButtonTrigger)

Example 24 with MouseButtonTrigger

use of com.jme3.input.controls.MouseButtonTrigger in project jmonkeyengine by jMonkeyEngine.

the class TerrainTestModifyHeight method setupKeys.

private void setupKeys() {
    flyCam.setMoveSpeed(100);
    inputManager.addMapping("wireframe", new KeyTrigger(KeyInput.KEY_T));
    inputManager.addListener(actionListener, "wireframe");
    inputManager.addMapping("Raise", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addListener(actionListener, "Raise");
    inputManager.addMapping("Lower", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
    inputManager.addListener(actionListener, "Lower");
}
Also used : KeyTrigger(com.jme3.input.controls.KeyTrigger) MouseButtonTrigger(com.jme3.input.controls.MouseButtonTrigger)

Aggregations

MouseButtonTrigger (com.jme3.input.controls.MouseButtonTrigger)20 KeyTrigger (com.jme3.input.controls.KeyTrigger)10 Material (com.jme3.material.Material)8 Geometry (com.jme3.scene.Geometry)7 Box (com.jme3.scene.shape.Box)6 BulletAppState (com.jme3.bullet.BulletAppState)5 ActionListener (com.jme3.input.controls.ActionListener)5 Vector3f (com.jme3.math.Vector3f)5 Sphere (com.jme3.scene.shape.Sphere)5 SphereCollisionShape (com.jme3.bullet.collision.shapes.SphereCollisionShape)4 Quaternion (com.jme3.math.Quaternion)4 Vector2f (com.jme3.math.Vector2f)3 Node (com.jme3.scene.Node)3 Quad (com.jme3.scene.shape.Quad)3 Texture (com.jme3.texture.Texture)3 ChaseCameraAppState (com.jme3.app.ChaseCameraAppState)2 RigidBodyControl (com.jme3.bullet.control.RigidBodyControl)2 BitmapText (com.jme3.font.BitmapText)2 Joystick (com.jme3.input.Joystick)2 MouseAxisTrigger (com.jme3.input.controls.MouseAxisTrigger)2