当前位置: 首页>>代码示例>>Java>>正文


Java MouseButtonTrigger类代码示例

本文整理汇总了Java中com.jme3.input.controls.MouseButtonTrigger的典型用法代码示例。如果您正苦于以下问题:Java MouseButtonTrigger类的具体用法?Java MouseButtonTrigger怎么用?Java MouseButtonTrigger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MouseButtonTrigger类属于com.jme3.input.controls包,在下文中一共展示了MouseButtonTrigger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupKeys

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
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");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:TerrainTestCollision.java

示例2: simpleInitApp

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
@Override
public void simpleInitApp() {
  /** Set up Physics Game */
  bulletAppState = new BulletAppState();
  stateManager.attach(bulletAppState);
  /** Configure cam to look at scene */
  cam.setLocation(new Vector3f(0, 6f, 6f));
  cam.lookAt(Vector3f.ZERO, new Vector3f(0, 1, 0));
  cam.setFrustumFar(15);
  /** Add InputManager action: Left click triggers shooting. */
  inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
  inputManager.addListener(actionListener, "shoot");
  /** Initialize the scene, materials, and physics space */
  initMaterials();
  initWall();
  initFloor();
  initCrossHairs();
  initShadows();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:HelloPhysics.java

示例3: setupKeys

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
private void setupKeys() {
    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("Space", new KeyTrigger(KeyInput.KEY_SPACE));
    inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addListener(this, "shoot");
    inputManager.addListener(this, "Lefts");
    inputManager.addListener(this, "Rights");
    inputManager.addListener(this, "Ups");
    inputManager.addListener(this, "Downs");
    inputManager.addListener(this, "Space");
    inputManager.addMapping("gc", new KeyTrigger(KeyInput.KEY_X));
    inputManager.addListener(this, "gc");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:TestPhysicsCharacter.java

示例4: initKeys

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
public void initKeys(InputManager inputManager) {
    inputManager.addMapping(name + "LeftClick", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addMapping(name + "RightClick", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
    inputManager.addMapping(name + "MouseMove",
            new MouseAxisTrigger(MouseInput.AXIS_X, true),
            new MouseAxisTrigger(MouseInput.AXIS_X, false),
            new MouseAxisTrigger(MouseInput.AXIS_Y, true),
            new MouseAxisTrigger(MouseInput.AXIS_Y, false));
    inputManager.addMapping(name + "PlaneRotate", new KeyTrigger(KeyInput.KEY_SLASH));
    inputManager.addMapping(name + "PlaneRotate90", new KeyTrigger(KeyInput.KEY_LCONTROL));

    inputManager.addListener(this, "shiftKey");

    inputManager.addListener(this, name + "LeftClick");
    inputManager.addListener(this, name + "RightClick");
    inputManager.addListener(this, name + "MouseMove");
    inputManager.addListener(this, name + "PlaneRotate");
    inputManager.addListener(this, name + "PlaneRotate90");
}
 
开发者ID:dwhuang,项目名称:SMILE,代码行数:20,代码来源:Demonstrator.java

示例5: keyMapping

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
public void keyMapping() {
	inputManager.addMapping("buttonLeft", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
	inputManager.addMapping("buttonRight", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
	inputManager.addMapping("1", new KeyTrigger(KeyInput.KEY_1));
	inputManager.addMapping("2", new KeyTrigger(KeyInput.KEY_2));
	inputManager.addMapping("3", new KeyTrigger(KeyInput.KEY_3));
	inputManager.addMapping("4", new KeyTrigger(KeyInput.KEY_4));
	inputManager.addMapping("5", new KeyTrigger(KeyInput.KEY_5));
	inputManager.addMapping("6", new KeyTrigger(KeyInput.KEY_6));
	inputManager.addMapping("w", new KeyTrigger(KeyInput.KEY_W));
	inputManager.addMapping("s", new KeyTrigger(KeyInput.KEY_S));
	inputManager.addMapping("a", new KeyTrigger(KeyInput.KEY_A));
	inputManager.addMapping("d", new KeyTrigger(KeyInput.KEY_D));
	inputManager.addMapping("space", new KeyTrigger(KeyInput.KEY_SPACE));
	inputManager.addListener(this, "1", "2", "3", "4", "5", "6", "w", "s",
			"a", "d", "space", "buttonLeft", "buttonRight");
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:18,代码来源:TestRole.java

示例6: bindListener

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
private void bindListener() {
    // delete old
    if (inputManager.hasMapping(mappingName)) {
        inputManager.deleteMapping(mappingName);
    }
    
    // bind new
    switch (type) {
        case key:
            inputManager.addMapping(mappingName, new KeyTrigger(code));
            break;
        case button:
            inputManager.addMapping(mappingName, new MouseButtonTrigger(code));
            break;
        case axis:
            inputManager.addMapping(mappingName, new MouseAxisTrigger(code, negative));
            break;
        default:
            throw new UnsupportedOperationException("Unsupported event type=" + type + ", eventMapping=" + this);
    }
    inputManager.addListener(actionListener, mappingName);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:23,代码来源:JmeKeyMapping.java

示例7: registerInput

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
private void registerInput() {
	if (brushGeom == null) {
		brushGeom = new Geometry("brush", new Quad(BRUSH_RADIUS*2, BRUSH_RADIUS*2));
		Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
		mat.setTexture("ColorMap", app.getAssetManager().loadTexture("org/shaman/terrain/polygonal/Brush.png"));
		mat.getAdditionalRenderState().setDepthTest(false);
		mat.getAdditionalRenderState().setDepthWrite(false);
		mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
		brushGeom.setMaterial(mat);
		graphNode.attachChild(brushGeom);
		brushGeom.setCullHint(Spatial.CullHint.Always);
		
		listener = new InputListenerImpl();
		app.getInputManager().addMapping("PolygonalMouseX+", new MouseAxisTrigger(MouseInput.AXIS_X, false));
		app.getInputManager().addMapping("PolygonalMouseX-", new MouseAxisTrigger(MouseInput.AXIS_X, true));
		app.getInputManager().addMapping("PolygonalMouseY+", new MouseAxisTrigger(MouseInput.AXIS_Y, false));
		app.getInputManager().addMapping("PolygonalMouseY-", new MouseAxisTrigger(MouseInput.AXIS_Y, true));
		app.getInputManager().addMapping("PolygonalMouseLeft", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
		app.getInputManager().addMapping("PolygonalMouseRight", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
	}
	app.getInputManager().addListener(listener, "PolygonalMouseX+", "PolygonalMouseX-", "PolygonalMouseY+", 
			"PolygonalMouseY-", "PolygonalMouseLeft", "PolygonalMouseRight");
}
 
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:24,代码来源:PolygonalMapGenerator.java

示例8: Recording

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
public Recording(TerrainHeighmapCreator app, Camera cam, Node sceneNode) {
	this.app = app;
	this.cam = cam;
	this.sceneNode = new Node("record");
	sceneNode.attachChild(this.sceneNode);
	this.points = new ArrayList<>();
	
	sphereMesh = new Sphere(8, 8, 0.25f*TerrainHeighmapCreator.TERRAIN_SCALE);
	sphereMat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
	sphereMat.setColor("Color", ColorRGBA.Blue);
	arrowMat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
	arrowMat.getAdditionalRenderState().setWireframe(true);
	arrowMat.setColor("Color", ColorRGBA.Red);
	
	app.getNifty().addXml("org/shaman/terrain/vegetation/DummyScreen.xml");
	app.getInputManager().addMapping("RecordingAdd", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
	app.getInputManager().addMapping("RecordingSpeed-", new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
	app.getInputManager().addMapping("RecordingSpeed+", new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
	app.getInputManager().addListener(this, "RecordingAdd", "RecordingSpeed-", "RecordingSpeed+");
}
 
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:21,代码来源:Recording.java

示例9: initControls

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
public void initControls(InputManager inputManager) {
    inputManager.deleteMapping(SimpleApplication.INPUT_MAPPING_EXIT);

    inputManager.addMapping("open_menu", new KeyTrigger(KeyInput.KEY_ESCAPE));
    inputManager.addMapping("view_atom", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addListener(new ActionListener() {
        @Override
        public void onAction(String name, boolean isPressed, float tpf) {
            if ("open_menu".equals(name) && isPressed) {
                NiftyAppState s = stateManager.getState(NiftyAppState.class);
                if ("menu".equals(s.nifty.getCurrentScreen().getScreenId())) {
                    s.exitMenu();
                } else {
                    s.openMenu();
                }
            } else if ("view_atom".equals(name) && isPressed) {
                triggerViewAtom();
            }
        }
    }, "open_menu", "view_atom");
}
 
开发者ID:matthewseal,项目名称:MoleculeViewer,代码行数:22,代码来源:MVAppState.java

示例10: setupKeys

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
private void setupKeys(InputManager inputManager){
 
   //Set up keys and listener to read it
    String[] mappings = new String[]{
        "MoveShip",
        "FireBullets",
        "FireRocket",
        "LockMouse",
        "SelectAim"
    };
    
    InputManager input = asm.getInputManager();
    
    input.addMapping("LockMouse", new KeyTrigger(KeyInput.KEY_SPACE));
    input.addMapping("SelectAim", new KeyTrigger(KeyInput.KEY_E));
    input.addMapping("MoveShip", new KeyTrigger(KeyInput.KEY_W));
    input.addMapping("FireBullets", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    input.addListener(anl, mappings);
    input.addListener(acl, mappings);
}
 
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:21,代码来源:PlayerMappings.java

示例11: setCam

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
void setCam() {
        chaseCam = new ChaseCamera(cam, ship, inputManager);
        chaseCam.setDragToRotate(true);
        chaseCam.setTrailingEnabled(false);

        chaseCam.setInvertVerticalAxis(true);

        chaseCam.setMinVerticalRotation(-FastMath.PI * 0.45f);
        chaseCam.setMaxVerticalRotation(FastMath.PI * 0.45f);

        chaseCam.setMinDistance(10f);
        chaseCam.setMaxDistance(20f);

        chaseCam.setRotationSpeed(0.3f);
//        chaseCam.setDownRotateOnCloseViewOnly(false);   
//        chaseCam.setHideCursorOnRotate(false);

        chaseCam.setToggleRotationTrigger(new MouseButtonTrigger(MouseInput.BUTTON_MIDDLE));
        chaseCam.setEnabled(true);
    }
 
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:21,代码来源:SpaceShip.java

示例12: onContextGainFocus

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
@Override
    public void onContextGainFocus(SimpleApplication app, Canvas canvas) {
        add(canvas, BorderLayout.CENTER);
        this.app = app;
        app.getInputManager().addMapping(MouseInputEvent.MouseInputEventType.LMB.toString(), 
                new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
        app.getInputManager().addMapping(MouseInputEvent.MouseInputEventType.RMB.toString(),
                new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
//        app.getInputManager().addMapping("Confirm", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
//        app.getInputManager().addMapping("Cancel", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));


//        app.getFlyByCamera().setEnabled(false);
        rtsCam.setCenter(camPos);
        app.getStateManager().attachAll(rtsCam, hexGridState, mouseSystem);
        if(!init) {
            for (HexGridPropertiesPan pan : propertiesPans) {
                pan.onMapLoaded();
            }
            init = true;
        }
        revalidate();
    }
 
开发者ID:MultiverseKing,项目名称:HexGrid_JME,代码行数:24,代码来源:HexGridModule.java

示例13: initialize

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
@Override
public void initialize() {
	Logger.getLogger("com.jme3").setLevel(Level.WARNING);
	super.initialize();
	
	getStateManager().attach(DatabaseState.getSingleton());
	
	getStateManager().attach(SettingsState.getSingleton());
	
	RootNodeState rns = new RootNodeState();
	rns.setEnabled(true);
	getStateManager().attach(rns);
	
	AppEngineState cs = new AppEngineState();
	getStateManager().attach(cs);
	
	inputManager.addMapping("PlayerStrafeLeft", new KeyTrigger(KeyInput.KEY_A));
	inputManager.addMapping("PlayerStrafeRight", new KeyTrigger(KeyInput.KEY_D));
	inputManager.addMapping("PlayerMoveForward", new KeyTrigger(KeyInput.KEY_W));
	inputManager.addMapping("PlayerMoveBackward", new KeyTrigger(KeyInput.KEY_S));
	inputManager.addMapping("SendChat", new KeyTrigger(KeyInput.KEY_RETURN));
	inputManager.addMapping("PlayerShoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
}
 
开发者ID:AMPBEdu,项目名称:gjOryx,代码行数:24,代码来源:JOryx.java

示例14: registerInputs

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
@Override
protected void registerInputs(InputManager inputManager) {
	inputManager.addMapping(SWITCH_CTRL_1, new KeyTrigger(KeyInput.KEY_F1));
	inputManager.addMapping(SWITCH_CTRL_2, new KeyTrigger(KeyInput.KEY_F2));
	inputManager.addMapping(SWITCH_CTRL_3, new KeyTrigger(KeyInput.KEY_F3));
	inputManager.addMapping(SELECT, new MouseButtonTrigger(0));
	inputManager.addMapping(ACTION, new MouseButtonTrigger(1));
	inputManager.addMapping(MOVE_ATTACK, new KeyTrigger(KeyInput.KEY_A));
	inputManager.addMapping(MULTIPLE_SELECTION, new KeyTrigger(KeyInput.KEY_LCONTROL),
			new KeyTrigger(KeyInput.KEY_RCONTROL));
	inputManager.addMapping(HOLD, new KeyTrigger(KeyInput.KEY_H));
	inputManager.addMapping(PAUSE, new KeyTrigger(KeyInput.KEY_SPACE));

	inputManager.addListener(this, mappings);

	logger.info("battlefield controller online");
}
 
开发者ID:methusalah,项目名称:OpenRTS,代码行数:18,代码来源:BattlefieldInputInterpreter.java

示例15: initialize

import com.jme3.input.controls.MouseButtonTrigger; //导入依赖的package包/类
@Override
public void initialize(AppStateManager stateManager, Application app) {
	super.initialize(stateManager, app);
	placePieceByMouseAppState.initialize(stateManager, app);
	selectPieceByMouseAppState.initialize(stateManager, app);
	
	changeStateTo(State.WAITING);
	
	inputManager = app.getInputManager();
	
	
	inputManager.addMapping(CLICK_MAPPING, new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
	inputManager.addMapping(CANCEL_MAPPING, new KeyTrigger(KeyInput.KEY_ESCAPE));
	inputManager.addMapping(DELETE_MAPPING, new KeyTrigger(KeyInput.KEY_DELETE));
	inputManager.addMapping(POV_MAPPING, new KeyTrigger(KeyInput.KEY_P));
	inputManager.addMapping(MOUSE_WHEEL_UP_MAPPING, new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
	inputManager.addMapping(MOUSE_WHEEL_DOWN_MAPPING, new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));

	inputManager.addListener(this, CLICK_MAPPING, CANCEL_MAPPING, DELETE_MAPPING, POV_MAPPING, MOUSE_WHEEL_UP_MAPPING, MOUSE_WHEEL_DOWN_MAPPING);
}
 
开发者ID:lyrgard,项目名称:HexScape,代码行数:21,代码来源:PieceControlerAppState.java


注:本文中的com.jme3.input.controls.MouseButtonTrigger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。