本文整理汇总了Java中com.jme3.input.controls.MouseAxisTrigger类的典型用法代码示例。如果您正苦于以下问题:Java MouseAxisTrigger类的具体用法?Java MouseAxisTrigger怎么用?Java MouseAxisTrigger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MouseAxisTrigger类属于com.jme3.input.controls包,在下文中一共展示了MouseAxisTrigger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initKeys
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的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: bindListener
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的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);
}
示例3: registerInput
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的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");
}
示例4: Recording
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的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+");
}
示例5: registerInputs
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的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);
}
示例6: initialize
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的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);
}
示例7: registerInput
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的package包/类
/**
* Registers inputs with the input manager
*
* @param inputManager the input manager
*/
public final void registerInput(final InputManager inputManager) {
this.inputManager = inputManager;
if (!inputManager.hasMapping(CHASECAM_DOWN)) {
inputManager.addMapping(CHASECAM_DOWN, new MouseAxisTrigger(MouseInput.AXIS_Y, false));
}
if (!inputManager.hasMapping(CHASECAM_UP)) {
inputManager.addMapping(CHASECAM_UP, new MouseAxisTrigger(MouseInput.AXIS_Y, true));
}
if (!inputManager.hasMapping(CHASECAM_ZOOMIN)) {
inputManager.addMapping(CHASECAM_ZOOMIN, new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
}
if (!inputManager.hasMapping(CHASECAM_ZOOMOUT)) {
inputManager.addMapping(CHASECAM_ZOOMOUT, new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
}
if (!inputManager.hasMapping(CHASECAM_MOVELEFT)) {
inputManager.addMapping(CHASECAM_MOVELEFT, new MouseAxisTrigger(MouseInput.AXIS_X, true));
}
if (!inputManager.hasMapping(CHASECAM_MOVERIGHT)) {
inputManager.addMapping(CHASECAM_MOVERIGHT, new MouseAxisTrigger(MouseInput.AXIS_X, false));
}
if (!inputManager.hasMapping(CHASECAM_TOGGLEROTATE)) {
inputManager.addMapping(CHASECAM_TOGGLEROTATE, new MouseButtonTrigger(MouseInput.BUTTON_MIDDLE));
}
inputManager.addListener(this, ALL_INPUTS);
}
示例8: setupCameraControls
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的package包/类
public void setupCameraControls(CameraControls cameraControls) {
inputManager.addMapping(INCREASE_FOV, new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
inputManager.addMapping(DECREASE_FOV, new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addMapping(COCKPIT_VIEW, new KeyTrigger(KeyInput.KEY_F1));
inputManager.addMapping(OUTER_VIEW, new KeyTrigger(KeyInput.KEY_F5));
inputManager.addMapping(MOUSE_LEFT, new MouseAxisTrigger(MouseInput.AXIS_X, false));
inputManager.addMapping(MOUSE_RIGHT, new MouseAxisTrigger(MouseInput.AXIS_X, true));
inputManager.addMapping(MOUSE_UP, new MouseAxisTrigger(MouseInput.AXIS_Y, true));
inputManager.addMapping(MOUSE_DOWN, new MouseAxisTrigger(MouseInput.AXIS_Y, false));
inputManager.addMapping(CENTER_CAMERA, new MouseButtonTrigger(MouseInput.BUTTON_MIDDLE), new KeyTrigger(KeyInput.KEY_NUMPAD5));
inputManager.addListener(cameraControls, INCREASE_FOV, DECREASE_FOV, COCKPIT_VIEW,
OUTER_VIEW, MOUSE_UP, MOUSE_DOWN, MOUSE_RIGHT, MOUSE_LEFT, CENTER_CAMERA);
}
示例9: simpleInitApp
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的package包/类
@Override
public void simpleInitApp() {
// Test multiple inputs per mapping
inputManager.addMapping("My Action",
new KeyTrigger(KeyInput.KEY_SPACE),
new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
// Test multiple listeners per mapping
inputManager.addListener(actionListener, "My Action");
inputManager.addListener(analogListener, "My Action");
}
示例10: registerWithInput
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的package包/类
/**
* Registers inputs with the input manager
* @param inputManager
*/
public final void registerWithInput(InputManager inputManager) {
String[] inputs = {ChaseCamToggleRotate,
ChaseCamDown,
ChaseCamUp,
ChaseCamMoveLeft,
ChaseCamMoveRight,
ChaseCamZoomIn,
ChaseCamZoomOut};
this.inputManager = inputManager;
if (!invertYaxis) {
inputManager.addMapping(ChaseCamDown, new MouseAxisTrigger(MouseInput.AXIS_Y, true));
inputManager.addMapping(ChaseCamUp, new MouseAxisTrigger(MouseInput.AXIS_Y, false));
} else {
inputManager.addMapping(ChaseCamDown, new MouseAxisTrigger(MouseInput.AXIS_Y, false));
inputManager.addMapping(ChaseCamUp, new MouseAxisTrigger(MouseInput.AXIS_Y, true));
}
inputManager.addMapping(ChaseCamZoomIn, new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
inputManager.addMapping(ChaseCamZoomOut, new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
if(!invertXaxis){
inputManager.addMapping(ChaseCamMoveLeft, new MouseAxisTrigger(MouseInput.AXIS_X, true));
inputManager.addMapping(ChaseCamMoveRight, new MouseAxisTrigger(MouseInput.AXIS_X, false));
}else{
inputManager.addMapping(ChaseCamMoveLeft, new MouseAxisTrigger(MouseInput.AXIS_X, false));
inputManager.addMapping(ChaseCamMoveRight, new MouseAxisTrigger(MouseInput.AXIS_X, true));
}
inputManager.addMapping(ChaseCamToggleRotate, new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addMapping(ChaseCamToggleRotate, new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
inputManager.addListener(this, inputs);
}
示例11: setInvertVerticalAxis
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的package包/类
/**
* invert the vertical axis movement of the mouse
* @param invertYaxis
*/
public void setInvertVerticalAxis(boolean invertYaxis) {
this.invertYaxis = invertYaxis;
inputManager.deleteMapping(ChaseCamDown);
inputManager.deleteMapping(ChaseCamUp);
if (!invertYaxis) {
inputManager.addMapping(ChaseCamDown, new MouseAxisTrigger(MouseInput.AXIS_Y, true));
inputManager.addMapping(ChaseCamUp, new MouseAxisTrigger(MouseInput.AXIS_Y, false));
} else {
inputManager.addMapping(ChaseCamDown, new MouseAxisTrigger(MouseInput.AXIS_Y, false));
inputManager.addMapping(ChaseCamUp, new MouseAxisTrigger(MouseInput.AXIS_Y, true));
}
inputManager.addListener(this, ChaseCamDown, ChaseCamUp);
}
示例12: setInvertHorizontalAxis
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的package包/类
/**
* invert the Horizontal axis movement of the mouse
* @param invertYaxis
*/
public void setInvertHorizontalAxis(boolean invertXaxis) {
this.invertXaxis = invertXaxis;
inputManager.deleteMapping(ChaseCamMoveLeft);
inputManager.deleteMapping(ChaseCamMoveRight);
if(!invertXaxis){
inputManager.addMapping(ChaseCamMoveLeft, new MouseAxisTrigger(MouseInput.AXIS_X, true));
inputManager.addMapping(ChaseCamMoveRight, new MouseAxisTrigger(MouseInput.AXIS_X, false));
}else{
inputManager.addMapping(ChaseCamMoveLeft, new MouseAxisTrigger(MouseInput.AXIS_X, false));
inputManager.addMapping(ChaseCamMoveRight, new MouseAxisTrigger(MouseInput.AXIS_X, true));
}
inputManager.addListener(this, ChaseCamMoveLeft, ChaseCamMoveRight);
}
示例13: initInputs
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的package包/类
private void initInputs() {
String[] mappings = new String[]{
"Left",
"Right",
"Up",
"Down",};
inputManager.addMapping("Left", new MouseAxisTrigger(0, true));
inputManager.addMapping("Right", new MouseAxisTrigger(0, false));
inputManager.addMapping("Up", new MouseAxisTrigger(1, false));
inputManager.addMapping("Down", new MouseAxisTrigger(1, true));
inputManager.addListener(this, mappings);
}
示例14: registerWithInput
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的package包/类
/**
* Registers inputs with the input manager
*
* @param inputManager
*/
public final void registerWithInput(InputManager inputManager) {
inputs = new String[]{ChaseCamToggleRotate,
ChaseCamDown,
ChaseCamUp,
ChaseCamMoveLeft,
ChaseCamMoveRight,
ChaseCamZoomIn,
ChaseCamZoomOut};
// this.inputM = inputManager;
// if (!invertYaxis) {
inputManager.addMapping(ChaseCamDown, new MouseAxisTrigger(MouseInput.AXIS_Y, true));
inputManager.addMapping(ChaseCamUp, new MouseAxisTrigger(MouseInput.AXIS_Y, false));
// } else {
// inputManager.addMapping(ChaseCamDown, new MouseAxisTrigger(MouseInput.AXIS_Y, false));
// inputManager.addMapping(ChaseCamUp, new MouseAxisTrigger(MouseInput.AXIS_Y, true));
// }
inputManager.addMapping(ChaseCamZoomIn, new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
inputManager.addMapping(ChaseCamZoomOut, new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
// if (!invertXaxis) {
inputManager.addMapping(ChaseCamMoveLeft, new MouseAxisTrigger(MouseInput.AXIS_X, true));
inputManager.addMapping(ChaseCamMoveRight, new MouseAxisTrigger(MouseInput.AXIS_X, false));
// } else {
// inputManager.addMapping(ChaseCamMoveLeft, new MouseAxisTrigger(MouseInput.AXIS_X, false));
// inputManager.addMapping(ChaseCamMoveRight, new MouseAxisTrigger(MouseInput.AXIS_X, true));
// }
inputManager.addMapping(ChaseCamToggleRotate, new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
// inputManager.addMapping(ChaseCamToggleRotate, new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
inputManager.addListener(this, inputs);
}
示例15: registerMouse
import com.jme3.input.controls.MouseAxisTrigger; //导入依赖的package包/类
private void registerMouse() {
inputManager.addMapping("-WHEEL", new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
inputManager.addMapping("+WHEEL", new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
inputManager.addMapping("-MOUSEX", new MouseAxisTrigger(MouseInput.AXIS_X, false));
inputManager.addMapping("+MOUSEX", new MouseAxisTrigger(MouseInput.AXIS_X, true));
inputManager.addMapping("-MOUSEY", new MouseAxisTrigger(MouseInput.AXIS_Y, false));
inputManager.addMapping("+MOUSEY", new MouseAxisTrigger(MouseInput.AXIS_Y, true));
inputManager.addMapping("BUTTON1", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addMapping("BUTTON2", new MouseButtonTrigger(MouseInput.BUTTON_MIDDLE));
inputManager.addMapping("BUTTON3", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
}