本文整理汇总了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");
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}