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


Java InputManager.deleteMapping方法代码示例

本文整理汇总了Java中com.jme3.input.InputManager.deleteMapping方法的典型用法代码示例。如果您正苦于以下问题:Java InputManager.deleteMapping方法的具体用法?Java InputManager.deleteMapping怎么用?Java InputManager.deleteMapping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.input.InputManager的用法示例。


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

示例1: initControls

import com.jme3.input.InputManager; //导入方法依赖的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

示例2: bindMouse

import com.jme3.input.InputManager; //导入方法依赖的package包/类
private void bindMouse(InputManager inputManager, String mapName, int button, InputListener listener) {
    // 先移除旧的,再增加新的,避免listener重复(在一些退出后没有清理mapping时的情况可能发生)
    if (inputManager.hasMapping(mapName)) {
        inputManager.deleteMapping(mapName);
    }
    
    Trigger t = new MouseButtonTrigger(button);
    inputManager.addMapping(mapName, t);
    inputManager.addListener(listener, mapName);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:11,代码来源:UIState.java

示例3: unregisterInputs

import com.jme3.input.InputManager; //导入方法依赖的package包/类
@Override
public void unregisterInputs(InputManager inputManager){
	for(String s : mappings) {
		if(inputManager.hasMapping(s)) {
			inputManager.deleteMapping(s);
		}
	}
	inputManager.removeListener(this);
}
 
开发者ID:methusalah,项目名称:OpenRTS,代码行数:10,代码来源:IsometricCameraManager.java

示例4: unregisterInputs

import com.jme3.input.InputManager; //导入方法依赖的package包/类
@Override
protected void unregisterInputs(InputManager inputManager) {
	for (String s : mappings) {
		if (inputManager.hasMapping(s)) {
			inputManager.deleteMapping(s);
		}
	}
	inputManager.removeListener(this);
}
 
开发者ID:methusalah,项目名称:OpenRTS,代码行数:10,代码来源:BattlefieldInputInterpreter.java

示例5: cleanup

import com.jme3.input.InputManager; //导入方法依赖的package包/类
@Override
public void cleanup() {
    super.cleanup();
    InputManager inputManager = Globals.app.getInputManager();
    inputManager.deleteMapping(FASTER);
    inputManager.deleteMapping(SLOWER);
    inputManager.deleteMapping(DEFAULT);
    inputManager.deleteMapping(LOG_TIME);
    inputManager.removeListener(this);
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:11,代码来源:ReplayInputHandler.java

示例6: installCameraKeys

import com.jme3.input.InputManager; //导入方法依赖的package包/类
/**
 * Installs the defines camera keys for the application.
 *
 * @param flyCam the flyby camera to install the keys for.
 * @param inputManager the inputmanager of the sandbox application.
 */
public void installCameraKeys(DAEFlyByCamera flyCam, InputManager inputManager, boolean deleteMapping) {
    if (deleteMapping) {
        for (String mapping : cameraKeys) {
            inputManager.deleteMapping(mapping);
        }
    }


    Locale l = this.getInputLocale();
    Logger.getLogger("DArtE").log(Level.INFO, "Keyboard language : {0} , country : {1}", new Object[]{l.getLanguage(), l.getCountry()});
    ResourceBundle cameraKeyBundle = ResourceBundle.getBundle("i18n.camerakeys", l);

    GlobalObjects go = GlobalObjects.getInstance();
    boolean useCustomKeys = go.getBooleanPreference("CustomKeys", false);

    String keyStrokeLeft = cameraKeyBundle.getString("FLYCAM_Left");
    int leftKeyCode = Integer.parseInt(keyStrokeLeft, 16);
    inputManager.addMapping("FLYCAM_Left", new MouseAxisTrigger(0, true),
            new KeyTrigger(leftKeyCode));

    String keyStrokeRight = cameraKeyBundle.getString("FLYCAM_Right");
    int rightKeyCode = Integer.parseInt(keyStrokeRight, 16);
    inputManager.addMapping("FLYCAM_Right", new MouseAxisTrigger(0, false),
            new KeyTrigger(rightKeyCode));

    String keyStrokeUp = cameraKeyBundle.getString("FLYCAM_Up");
    int upKeyCode = Integer.parseInt(keyStrokeUp, 16);
    inputManager.addMapping("FLYCAM_Up", new MouseAxisTrigger(1, false),
            new KeyTrigger(upKeyCode));

    String keyStrokeDown = cameraKeyBundle.getString("FLYCAM_Down");
    int downKeyCode = Integer.parseInt(keyStrokeDown, 16);
    inputManager.addMapping("FLYCAM_Down", new MouseAxisTrigger(1, true),
            new KeyTrigger(downKeyCode));

    inputManager.addMapping("FLYCAM_ZoomIn", new MouseAxisTrigger(2, false));
    inputManager.addMapping("FLYCAM_ZoomOut", new MouseAxisTrigger(2, true));
    inputManager.addMapping("FLYCAM_RotateDrag", new MouseButtonTrigger(0));

    if (useCustomKeys) {
        inputManager.addMapping("FLYCAM_StrafeLeft", getKeyCode("FLYCAM_StrafeLeft"));
        inputManager.addMapping("FLYCAM_StrafeRight", getKeyCode("FLYCAM_StrafeRight"));
        inputManager.addMapping("FLYCAM_Forward", getKeyCode("FLYCAM_Forward"));
        inputManager.addMapping("FLYCAM_Backward", getKeyCode("FLYCAM_Backward"));
        inputManager.addMapping("FLYCAM_Rise", getKeyCode("FLYCAM_Rise"));
        inputManager.addMapping("FLYCAM_Lower", getKeyCode("FLYCAM_Lower"));
    } else {
        inputManager.addMapping("FLYCAM_StrafeLeft", getKeyCode("FLYCAM_StrafeLeft", cameraKeyBundle));
        inputManager.addMapping("FLYCAM_StrafeRight", getKeyCode("FLYCAM_StrafeRight", cameraKeyBundle));
        inputManager.addMapping("FLYCAM_Forward", getKeyCode("FLYCAM_Forward", cameraKeyBundle));
        inputManager.addMapping("FLYCAM_Backward", getKeyCode("FLYCAM_Backward", cameraKeyBundle));
        inputManager.addMapping("FLYCAM_Rise", getKeyCode("FLYCAM_Rise", cameraKeyBundle));
        inputManager.addMapping("FLYCAM_Lower", getKeyCode("FLYCAM_Lower", cameraKeyBundle));
    }

    inputManager.addListener(flyCam, cameraKeys);
    flyCam.registerWithInput(inputManager);
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:65,代码来源:GlobalObjects.java


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