• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java JoyInput类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中com.jme3.input.JoyInput的典型用法代码示例。如果您正苦于以下问题:Java JoyInput类的具体用法?Java JoyInput怎么用?Java JoyInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

JoyInput类属于com.jme3.input包,在下文中一共展示了JoyInput类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: simpleInitApp

点赞 3

import com.jme3.input.JoyInput; //导入依赖的package包/类
@Override
public void simpleInitApp() {
    Joystick[] joysticks = inputManager.getJoysticks();
    if (joysticks == null)
        throw new IllegalStateException("Cannot find any joysticks!");
        
    for (Joystick joy : joysticks){
        System.out.println(joy.toString());
    }

    inputManager.addMapping("DPAD Left", new JoyAxisTrigger(0, JoyInput.AXIS_POV_X, true));
    inputManager.addMapping("DPAD Right", new JoyAxisTrigger(0, JoyInput.AXIS_POV_X, false));
    inputManager.addMapping("DPAD Down", new JoyAxisTrigger(0, JoyInput.AXIS_POV_Y, true));
    inputManager.addMapping("DPAD Up", new JoyAxisTrigger(0, JoyInput.AXIS_POV_Y, false));
    inputManager.addListener(this, "DPAD Left", "DPAD Right", "DPAD Down", "DPAD Up");

    inputManager.addMapping("Joy Left", new JoyAxisTrigger(0, 0, true));
    inputManager.addMapping("Joy Right", new JoyAxisTrigger(0, 0, false));
    inputManager.addMapping("Joy Down", new JoyAxisTrigger(0, 1, true));
    inputManager.addMapping("Joy Up", new JoyAxisTrigger(0, 1, false));
    inputManager.addListener(this, "Joy Left", "Joy Right", "Joy Down", "Joy Up");
}
 

开发者ID:mleoking,
项目名称:PhET,
代码行数:23,
代码来源:TestJoystick.java

示例2: gainFocus

点赞 2

import com.jme3.input.JoyInput; //导入依赖的package包/类
@Override
public void gainFocus() {
    logger.fine("gainFocus");
    if (view != null) {
        view.onResume();
    }

    if (app != null) {
        //resume the audio
        AudioRenderer audioRenderer = app.getAudioRenderer();
        if (audioRenderer != null) {
            audioRenderer.resumeAll();
        }
        //resume the sensors (aka joysticks)
        if (app.getContext() != null) {
            JoyInput joyInput = app.getContext().getJoyInput();
            if (joyInput != null) {
                if (joyInput instanceof AndroidSensorJoyInput) {
                    AndroidSensorJoyInput androidJoyInput = (AndroidSensorJoyInput) joyInput;
                    androidJoyInput.resumeSensors();
                }
            }
        }
    }

    isGLThreadPaused = false;

    if (app != null) {
        app.gainFocus();
    }
}
 

开发者ID:neph1,
项目名称:jme-cardboard,
代码行数:32,
代码来源:CardboardHarness.java

示例3: loseFocus

点赞 2

import com.jme3.input.JoyInput; //导入依赖的package包/类
@Override
public void loseFocus() {
    logger.fine("loseFocus");
    if (app != null) {
        app.loseFocus();
    }

    if (view != null) {
        view.onPause();
    }

    if (app != null) {
        //pause the audio
        AudioRenderer audioRenderer = app.getAudioRenderer();
        if (audioRenderer != null) {
            audioRenderer.pauseAll();
        }
        //pause the sensors (aka joysticks)
        if (app.getContext() != null) {
            JoyInput joyInput = app.getContext().getJoyInput();
            if (joyInput != null) {
                if (joyInput instanceof AndroidSensorJoyInput) {
                    AndroidSensorJoyInput androidJoyInput = (AndroidSensorJoyInput) joyInput;
                    androidJoyInput.pauseSensors();
                }
            }
        }
    }
    isGLThreadPaused = true;
}
 

开发者ID:neph1,
项目名称:jme-cardboard,
代码行数:31,
代码来源:CardboardHarness.java

示例4: getJoyInput

点赞 2

import com.jme3.input.JoyInput; //导入依赖的package包/类
public JoyInput getJoyInput() {
    return null;
}
 

开发者ID:mleoking,
项目名称:PhET,
代码行数:4,
代码来源:LwjglOffscreenBuffer.java

示例5: getJoyInput

点赞 2

import com.jme3.input.JoyInput; //导入依赖的package包/类
public JoyInput getJoyInput() {
    if (joyInput == null){
        joyInput = new JInputJoyInput();
    }
    return joyInput;
}
 

开发者ID:mleoking,
项目名称:PhET,
代码行数:7,
代码来源:LwjglAbstractDisplay.java

示例6: getJoyInput

点赞 2

import com.jme3.input.JoyInput; //导入依赖的package包/类
@Override
public JoyInput getJoyInput() {
    return innerContext.getJoyInput();
}
 

开发者ID:huliqing,
项目名称:LuoYing,
代码行数:5,
代码来源:JfxContext.java

示例7: registerWithInput

点赞 2

import com.jme3.input.JoyInput; //导入依赖的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: getJoyInput

点赞 2

import com.jme3.input.JoyInput; //导入依赖的package包/类
@Override
public JoyInput getJoyInput() {
    return null;
}
 

开发者ID:chototsu,
项目名称:MikuMikuStudio,
代码行数:5,
代码来源:OGLESContext.java

示例9: getJoyInput

点赞 1

import com.jme3.input.JoyInput; //导入依赖的package包/类
/**
 * @return Joystick input implementation. May be null if not available.
 */
public JoyInput getJoyInput();
 

开发者ID:mleoking,
项目名称:PhET,
代码行数:5,
代码来源:JmeContext.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)