本文整理汇总了Java中com.jme3.input.InputManager.addMapping方法的典型用法代码示例。如果您正苦于以下问题:Java InputManager.addMapping方法的具体用法?Java InputManager.addMapping怎么用?Java InputManager.addMapping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.input.InputManager
的用法示例。
在下文中一共展示了InputManager.addMapping方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initKeys
import com.jme3.input.InputManager; //导入方法依赖的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");
}
示例2: registerWithInput
import com.jme3.input.InputManager; //导入方法依赖的package包/类
/**
* Registers inputs with the input manager
* @param inputManager
*/
public final void registerWithInput(InputManager inputManager) {
String[] inputs = {EDIT_CAMERA_TOGGLEROTATE,
EDIT_CAMERA_DOWN,
EDIT_CAMERA_UP,
EDIT_CAMERA_MOVELEFT,
EDIT_CAMERA_MOVERIGHT,
EDIT_CAMERA_ZOOMIN,
EDIT_CAMERA_ZOOMOUT};
this.inputManager = inputManager;
inputManager.addMapping(EDIT_CAMERA_DOWN, new MouseAxisTrigger(MouseInput.AXIS_Y, true));
inputManager.addMapping(EDIT_CAMERA_UP, new MouseAxisTrigger(MouseInput.AXIS_Y, false));
inputManager.addMapping(EDIT_CAMERA_ZOOMIN, new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
inputManager.addMapping(EDIT_CAMERA_ZOOMOUT, new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
inputManager.addMapping(EDIT_CAMERA_MOVELEFT, new MouseAxisTrigger(MouseInput.AXIS_X, true));
inputManager.addMapping(EDIT_CAMERA_MOVERIGHT, new MouseAxisTrigger(MouseInput.AXIS_X, false));
inputManager.addMapping(EDIT_CAMERA_TOGGLEROTATE, new MouseButtonTrigger(MouseInput.BUTTON_MIDDLE));
inputManager.addListener(this, inputs);
}
示例3: 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");
}
示例4: registerWithInput
import com.jme3.input.InputManager; //导入方法依赖的package包/类
public void registerWithInput(InputManager inputManager) {
this.inputManager = inputManager;
String[] mappings = new String[] { "+SIDE", "+FWD", "+ROTATE", "+TILT", "+DISTANCE",
"-SIDE", "-FWD", "-ROTATE", "-TILT", "-DISTANCE", };
inputManager.addMapping("-SIDE", new KeyTrigger(KeyInput.KEY_A));
inputManager.addMapping("+SIDE", new KeyTrigger(KeyInput.KEY_D));
inputManager.addMapping("+FWD", new KeyTrigger(KeyInput.KEY_S));
inputManager.addMapping("-FWD", new KeyTrigger(KeyInput.KEY_W));
inputManager.addMapping("+ROTATE", new KeyTrigger(KeyInput.KEY_Q));
inputManager.addMapping("-ROTATE", new KeyTrigger(KeyInput.KEY_E));
inputManager.addMapping("+TILT", new KeyTrigger(KeyInput.KEY_R));
inputManager.addMapping("-TILT", new KeyTrigger(KeyInput.KEY_F));
inputManager.addMapping("-DISTANCE", new KeyTrigger(KeyInput.KEY_Z));
inputManager.addMapping("+DISTANCE", new KeyTrigger(KeyInput.KEY_X));
inputManager.addListener(this, mappings);
inputManager.setCursorVisible(true);
}
示例5: setupKeys
import com.jme3.input.InputManager; //导入方法依赖的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);
}
示例6: setupKeys
import com.jme3.input.InputManager; //导入方法依赖的package包/类
private void setupKeys() {
InputManager inputManager = app.getInputManager();
inputManager.addMapping("Rotate Left",
new KeyTrigger(KeyInput.KEY_A),
new KeyTrigger(KeyInput.KEY_LEFT));
inputManager.addMapping("Rotate Right",
new KeyTrigger(KeyInput.KEY_D),
new KeyTrigger(KeyInput.KEY_RIGHT));
inputManager.addMapping("Walk Forward",
new KeyTrigger(KeyInput.KEY_W),
new KeyTrigger(KeyInput.KEY_UP));
inputManager.addMapping("Walk Backward",
new KeyTrigger(KeyInput.KEY_S),
new KeyTrigger(KeyInput.KEY_DOWN));
inputManager.addMapping("Jump",
new KeyTrigger(KeyInput.KEY_SPACE));
// inputManager.addListener(this, "Strafe Left", "Strafe Right");
inputManager.addListener(this, "Rotate Left", "Rotate Right");
inputManager.addListener(this, "Walk Forward", "Walk Backward");
inputManager.addListener(this, "Jump");
inputManager = null;
}
示例7: registerInputs
import com.jme3.input.InputManager; //导入方法依赖的package包/类
@Override
public void registerInputs(InputManager inputManager){
inputManager.addMapping(ROTATE_UP, new MouseAxisTrigger(MouseInput.AXIS_Y, false));
inputManager.addMapping(ROTATE_DOWN, new MouseAxisTrigger(MouseInput.AXIS_Y, true));
inputManager.addMapping(ROTATE_LEFT, new MouseAxisTrigger(MouseInput.AXIS_X, true));
inputManager.addMapping(ROTATE_RIGHT, new MouseAxisTrigger(MouseInput.AXIS_X, false));
inputManager.addMapping(STRAFE_LEFT, new KeyTrigger(KeyInput.KEY_Q),
new KeyTrigger(KeyInput.KEY_LEFT));
inputManager.addMapping(STRAFE_RIGHT, new KeyTrigger(KeyInput.KEY_D),
new KeyTrigger(KeyInput.KEY_RIGHT));
inputManager.addMapping(MOVE_FOREWARD, new KeyTrigger(KeyInput.KEY_Z),
new KeyTrigger(KeyInput.KEY_UP));
inputManager.addMapping(MOVE_BACKWARD, new KeyTrigger(KeyInput.KEY_S),
new KeyTrigger(KeyInput.KEY_DOWN));
inputManager.addListener(this, mappings);
}
示例8: registerInputs
import com.jme3.input.InputManager; //导入方法依赖的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");
}
示例9: registerWithInput
import com.jme3.input.InputManager; //导入方法依赖的package包/类
/**
* Registers the FlyByCamera to recieve input events from the provided
* Dispatcher.
* @param dispacher
*/
public void registerWithInput(InputManager inputManager){
this.inputManager = inputManager;
String[] mappings = new String[]{
ROTATINGCAM_Left,
ROTATINGCAM_Right,
ROTATINGCAM_Up,
ROTATINGCAM_Down,
ROTATINGCAM_ZoomIn,
ROTATINGCAM_ZoomOut,
};
// both mouse and button - rotation of cam
inputManager.addMapping(ROTATINGCAM_Left, new KeyTrigger(AwtKeyInput.KEY_LEFT));
inputManager.addMapping(ROTATINGCAM_Right, new KeyTrigger(AwtKeyInput.KEY_RIGHT));
inputManager.addMapping(ROTATINGCAM_Up, new KeyTrigger(AwtKeyInput.KEY_UP));
inputManager.addMapping(ROTATINGCAM_Down, new KeyTrigger(AwtKeyInput.KEY_DOWN));
inputManager.addMapping(ROTATINGCAM_ZoomIn, new KeyTrigger(AwtKeyInput.KEY_ADD));
inputManager.addMapping(ROTATINGCAM_ZoomOut, new KeyTrigger(AwtKeyInput.KEY_SUBTRACT));
inputManager.addListener(this, mappings);
inputManager.setCursorVisible(true);
}
示例10: initialize
import com.jme3.input.InputManager; //导入方法依赖的package包/类
@Override
public void initialize(AppStateManager stateManager, Application app) {
if (!super.isInitialized()){
InputManager inputManager = app.getInputManager();
inputManager.addMapping("ScreenShot", new KeyTrigger(KeyInput.KEY_SYSRQ));
inputManager.addListener(this, "ScreenShot");
List<ViewPort> vps = app.getRenderManager().getPostViews();
ViewPort last = vps.get(vps.size()-1);
last.addProcessor(this);
appName = app.getClass().getSimpleName();
}
super.initialize(stateManager, app);
}
示例11: initialize
import com.jme3.input.InputManager; //导入方法依赖的package包/类
@Override
public void initialize(AppStateManager stateManager, Application app) {
super.initialize(stateManager, app);
InputManager inputManager = app.getInputManager();
inputManager.addMapping("ScreenShot", new KeyTrigger(KeyInput.KEY_SYSRQ));
inputManager.addListener(this, "ScreenShot");
List<ViewPort> vps = app.getRenderManager().getPostViews();
ViewPort last = vps.get(vps.size()-1);
last.addProcessor(this);
appName = app.getClass().getSimpleName();
}
示例12: initKeys
import com.jme3.input.InputManager; //导入方法依赖的package包/类
public void initKeys(InputManager inputManager) {
inputManager.addMapping(name + "MakeBlock", new KeyTrigger(KeyInput.KEY_B));
inputManager.addMapping(name + "MakeStack", new KeyTrigger(KeyInput.KEY_N));
inputManager.addMapping(name + "ClearTable", new KeyTrigger(KeyInput.KEY_C));
inputManager.addListener(this, "shiftKey");
inputManager.addListener(this, name + "MakeBlock");
inputManager.addListener(this, name + "MakeStack");
inputManager.addListener(this, name + "ClearTable");
}
示例13: 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);
}
示例14: addPrintJMEMapping
import com.jme3.input.InputManager; //导入方法依赖的package包/类
/**
* Adds the print jme mapping.
*
* @param inputManager
* the input manager
*/
private void addPrintJMEMapping(InputManager inputManager)
{
inputManager.addMapping("M3_PRINT_JME", new KeyTrigger(KeyInput.KEY_J));
actions.put("M3_PRINT_JME", new Callable<Void>()
{
@Override
public Void call() throws Exception
{
ContentSystemPrinter.logJMEStructure(log, Level.INFO, MultiplicityClientActionResponder.this.stage.getManipulableSpatial());
return null;
}
});
}
示例15: addPrintStageMapping
import com.jme3.input.InputManager; //导入方法依赖的package包/类
/**
* Adds the print stage mapping.
*
* @param inputManager
* the input manager
*/
private void addPrintStageMapping(InputManager inputManager)
{
inputManager.addMapping("M3_PRINT_STAGE", new KeyTrigger(KeyInput.KEY_D));
actions.put("M3_PRINT_STAGE", new Callable<Void>()
{
@Override
public Void call() throws Exception
{
ContentSystemPrinter.logContentSystemByZOrderFromRoot(log, Level.INFO, MultiplicityClientActionResponder.this.stage);
return null;
}
});
}