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


Java InputManager.setCursorVisible方法代码示例

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


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

示例1: setActiveCursor

import com.jme3.input.InputManager; //导入方法依赖的package包/类
/**
 * For internal use - Use setForcedCursor instead
 * 
 * @param cur
 */

public void setActiveCursor(CursorType cur) {
	if (!Objects.equals(cur, currentCursor)) {
		InputManager inputManager = getApplication().getInputManager();
		if (themeInstance != null && themeInstance.hasCursors()) {
			if (!forceCursor) {
				if (cur == null || cur.equals(CursorType.HIDDEN)) {
					inputManager.setCursorVisible(false);
				} else {
					inputManager.setCursorVisible(true);
					JmeCursor jmeCur = themeInstance.getCursor(cur);
					if (jmeCur != null) {
						inputManager.setMouseCursor(jmeCur);
					}
				}
			}
		}
		currentCursor = cur;
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:26,代码来源:BaseScreen.java

示例2: 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);
}
 
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:21,代码来源:RtsCameraControl.java

示例3: 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);
}
 
开发者ID:lyrgard,项目名称:HexScape,代码行数:29,代码来源:RotatingAroundCamera.java

示例4: registerWithInput

import com.jme3.input.InputManager; //导入方法依赖的package包/类
/**
 * Registers the FlyByCamera to receive input events from the provided
 * Dispatcher.
 * @param inputManager
 */
@Override
public void registerWithInput(InputManager inputManager){
    this.inputManager = inputManager;
    inputManager.setCursorVisible(dragToRotate || !isEnabled());

    Joystick[] joysticks = inputManager.getJoysticks();
    if (joysticks != null && joysticks.length > 0){
        for (Joystick j : joysticks) {
            mapJoystick(j);
        }
    }
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:18,代码来源:DAEFlyByCamera.java

示例5: registerWithInput

import com.jme3.input.InputManager; //导入方法依赖的package包/类
/**
 * Registers the FlyByCamera to receive input events from the provided
 * Dispatcher.
 * @param dispacher
 */
public void registerWithInput(InputManager inputManager){
	this.inputManager = inputManager;

	String[] mappings = new String[]{
			POVCAM_Left,
			POVCAM_Right,
			POVCAM_Up,
			POVCAM_Down,
			POVCAM_Mouse_Left,
			POVCAM_Mouse_Right,
			POVCAM_Mouse_Up,
			POVCAM_Mouse_Down,
			POVCAM_RotateDrag,
			POVCAM_Exit
	};

	// button only - exit
	inputManager.addMapping(POVCAM_Exit, new KeyTrigger(KeyInput.KEY_ESCAPE));
	
	// both mouse and button - rotation of cam
	inputManager.addMapping(POVCAM_Left, new KeyTrigger(KeyInput.KEY_LEFT));
	inputManager.addMapping(POVCAM_Right, new KeyTrigger(KeyInput.KEY_RIGHT));
	inputManager.addMapping(POVCAM_Up, new KeyTrigger(KeyInput.KEY_UP));
	inputManager.addMapping(POVCAM_Down, new KeyTrigger(KeyInput.KEY_DOWN));
	
	inputManager.addMapping(POVCAM_Mouse_Left, new MouseAxisTrigger(0, true));
	inputManager.addMapping(POVCAM_Mouse_Right, new MouseAxisTrigger(0, false));
	inputManager.addMapping(POVCAM_Mouse_Up, new MouseAxisTrigger(1, false));
	inputManager.addMapping(POVCAM_Mouse_Down, new MouseAxisTrigger(1, true));

	// mouse only - zoom in/out with wheel, and rotate drag
	inputManager.addMapping(POVCAM_RotateDrag, new MouseButtonTrigger(MouseInput.BUTTON_LEFT));

	inputManager.addListener(this, mappings);
	inputManager.setCursorVisible(dragToRotate);
}
 
开发者ID:lyrgard,项目名称:HexScape,代码行数:42,代码来源:PointOfViewCamera.java

示例6: registerWithInput

import com.jme3.input.InputManager; //导入方法依赖的package包/类
/**
     * Registers the FlyByCamera to receive input events from the provided
     * Dispatcher.
     * @param dispacher
     */
    public void registerWithInput(InputManager inputManager){
        this.inputManager = inputManager;
        
        String[] mappings = new String[]{
            "FLYCAM_Left",
            "FLYCAM_Right",
            "FLYCAM_Up",
            "FLYCAM_Down",

//            "FLYCAM_ZoomIn",
//            "FLYCAM_ZoomOut",
            "FLYCAM_RotateDrag",

        };

        // both mouse and button - rotation of cam
        inputManager.addMapping("FLYCAM_Left", new MouseAxisTrigger(MouseInput.AXIS_X, true),
                                               new KeyTrigger(KeyInput.KEY_LEFT));

        inputManager.addMapping("FLYCAM_Right", new MouseAxisTrigger(MouseInput.AXIS_X, false),
                                                new KeyTrigger(KeyInput.KEY_RIGHT));

        inputManager.addMapping("FLYCAM_Up", new MouseAxisTrigger(MouseInput.AXIS_Y, false),
                                             new KeyTrigger(KeyInput.KEY_UP));

        inputManager.addMapping("FLYCAM_Down", new MouseAxisTrigger(MouseInput.AXIS_Y, true),
                                               new KeyTrigger(KeyInput.KEY_DOWN));

        // mouse only - zoom in/out with wheel, and rotate drag
//        inputManager.addMapping("FLYCAM_ZoomIn", new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
//        inputManager.addMapping("FLYCAM_ZoomOut", new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
        inputManager.addMapping("FLYCAM_RotateDrag", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));

        inputManager.addListener(this, mappings);
        inputManager.setCursorVisible(dragToRotate);

        Joystick[] joysticks = inputManager.getJoysticks();
        if (joysticks != null && joysticks.length > 0){
            Joystick joystick = joysticks[0];
            joystick.assignAxis("FLYCAM_Right", "FLYCAM_Left", joystick.getXAxisIndex());
            joystick.assignAxis("FLYCAM_Down", "FLYCAM_Up", joystick.getYAxisIndex());
        }
    }
 
开发者ID:methusalah,项目名称:OpenRTS,代码行数:49,代码来源:StaticCamera.java

示例7: registerWithInput

import com.jme3.input.InputManager; //导入方法依赖的package包/类
@Override
public void registerWithInput(InputManager inputManager){
       this.inputManager = inputManager;
       
       String[] mappings = new String[]{
           "FLYCAM_Left",
           "FLYCAM_Right",
           "FLYCAM_Up",
           "FLYCAM_Down",

           "FLYCAM_StrafeLeft",
           "FLYCAM_StrafeRight",
           "FLYCAM_Forward",
           "FLYCAM_Backward",

           "FLYCAM_ZoomIn",
           "FLYCAM_ZoomOut",
           "FLYCAM_RotateDrag",

           "FLYCAM_Rise",
           "FLYCAM_Lower"
       };

       // both mouse and button - rotation of cam
       inputManager.addMapping("FLYCAM_Left", new MouseAxisTrigger(MouseInput.AXIS_X, true),
                                              new KeyTrigger(KeyInput.KEY_LEFT));

       inputManager.addMapping("FLYCAM_Right", new MouseAxisTrigger(MouseInput.AXIS_X, false),
                                               new KeyTrigger(KeyInput.KEY_RIGHT));

       inputManager.addMapping("FLYCAM_Up", new MouseAxisTrigger(MouseInput.AXIS_Y, false),
                                            new KeyTrigger(KeyInput.KEY_UP));

       inputManager.addMapping("FLYCAM_Down", new MouseAxisTrigger(MouseInput.AXIS_Y, true),
                                              new KeyTrigger(KeyInput.KEY_DOWN));

       // mouse only - zoom in/out with wheel, and rotate drag
       inputManager.addMapping("FLYCAM_ZoomIn", new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
       inputManager.addMapping("FLYCAM_ZoomOut", new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
       inputManager.addMapping("FLYCAM_RotateDrag", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));

       // keyboard only WASD for movement and WZ for rise/lower height
       inputManager.addMapping("FLYCAM_StrafeLeft", new KeyTrigger(KeyInput.KEY_Q));
       inputManager.addMapping("FLYCAM_StrafeRight", new KeyTrigger(KeyInput.KEY_D));
       inputManager.addMapping("FLYCAM_Forward", new KeyTrigger(KeyInput.KEY_Z));
       inputManager.addMapping("FLYCAM_Backward", new KeyTrigger(KeyInput.KEY_S));
       inputManager.addMapping("FLYCAM_Rise", new KeyTrigger(KeyInput.KEY_R));
       inputManager.addMapping("FLYCAM_Lower", new KeyTrigger(KeyInput.KEY_F));

       inputManager.addListener(this, mappings);
       inputManager.setCursorVisible(dragToRotate);

       Joystick[] joysticks = inputManager.getJoysticks();
       if (joysticks != null && joysticks.length > 0){
           Joystick joystick = joysticks[0];
           joystick.assignAxis("FLYCAM_StrafeRight", "FLYCAM_StrafeLeft", JoyInput.AXIS_POV_X);
           joystick.assignAxis("FLYCAM_Forward", "FLYCAM_Backward", JoyInput.AXIS_POV_Y);
           joystick.assignAxis("FLYCAM_Right", "FLYCAM_Left", joystick.getXAxisIndex());
           joystick.assignAxis("FLYCAM_Down", "FLYCAM_Up", joystick.getYAxisIndex());
       }
   }
 
开发者ID:methusalah,项目名称:OpenRTS,代码行数:62,代码来源:AzertyFlyByCamera.java

示例8: 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;
       
//        inputManager.registerJoystickAxisBinding("FLYCAM_Left",  2, JoyInput.AXIS_X, true);
//        inputManager.registerJoystickAxisBinding("FLYCAM_Right", 2, JoyInput.AXIS_X, false);
//        inputManager.registerJoystickAxisBinding("FLYCAM_Up",    2, JoyInput.AXIS_Y, true);
//        inputManager.registerJoystickAxisBinding("FLYCAM_Down",  2, JoyInput.AXIS_Y, false);
//
//        inputManager.registerJoystickAxisBinding("FLYCAM_StrafeLeft",  2, JoyInput.POV_X, true);
//        inputManager.registerJoystickAxisBinding("FLYCAM_StrafeRight", 2, JoyInput.POV_X, false);
//        inputManager.registerJoystickAxisBinding("FLYCAM_Forward",     2, JoyInput.POV_Y, true);
//        inputManager.registerJoystickAxisBinding("FLYCAM_Backward",    2, JoyInput.POV_Y, false);

        

        // both mouse and button - rotation of cam
        inputManager.addMapping("FLYCAM_Left", new MouseAxisTrigger(0, true));

        inputManager.addMapping("FLYCAM_Right", new MouseAxisTrigger(0, false));

        inputManager.addMapping("FLYCAM_Up", new MouseAxisTrigger(1, false));

        inputManager.addMapping("FLYCAM_Down", new MouseAxisTrigger(1, true));

        // mouse only - zoom in/out with wheel, and rotate drag
        inputManager.addMapping("FLYCAM_RotateDrag", new MouseButtonTrigger(1));

        // keyboard only WASD for movement and WZ for rise/lower height
        inputManager.addMapping("FLYCAM_StrafeLeft", new KeyTrigger(KeyInput.KEY_LEFT));
        inputManager.addMapping("FLYCAM_StrafeRight", new KeyTrigger(KeyInput.KEY_RIGHT));
        inputManager.addMapping("FLYCAM_Forward", new KeyTrigger(KeyInput.KEY_UP));
        inputManager.addMapping("FLYCAM_Backward", new KeyTrigger(KeyInput.KEY_DOWN));
        inputManager.addMapping("FLYCAM_Rise", new KeyTrigger(AwtKeyInput.KEY_ADD));
        inputManager.addMapping("FLYCAM_Lower", new KeyTrigger(AwtKeyInput.KEY_SUBTRACT));
       

        inputManager.addListener(this, mappings);
        inputManager.setCursorVisible(dragToRotate);
        
        initialUpVec = Vector3f.UNIT_Y;
    }
 
开发者ID:lyrgard,项目名称:HexScape,代码行数:47,代码来源:FlyByCamera.java


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