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


Java PovDirection.ordinal方法代码示例

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


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

示例1: getInputDisplayName

import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
public static String getInputDisplayName(int type, ConfigKeymap config, String key) {
    ConfigKeymap.Input input = config.getInput(key, -1, -1, -1);
    if (input.getInput() < 0)
        return "NONE";
    if (type == KEYBOARD && input.getInput() <= 255)
        return Input.Keys.toString(input.getInput());
    else if (type == CONTROLLER) {
        if (input.getType() == ConfigKeymap.Input.TYPE_AXIS)
            return String.format(Locale.US, "Axis %d %s", input.getInput(),
                    input.getExtra() == 0 ? "negative" : "positive");
        else if (input.getType() == ConfigKeymap.Input.TYPE_POV) {
            String pov = String.valueOf(input.getExtra());
            for (PovDirection dir : PovDirection.values())
                if (dir.ordinal() == input.getExtra())
                    pov = dir.name();
            return String.format(Locale.US, "D-pad %d %s", input.getInput(), pov);
        }
        else if (input.getType() == ConfigKeymap.Input.TYPE_BUTTON)
            return String.format(Locale.US, "Button %d", input.getInput());
    }
    return String.format(Locale.US, "%d", input.getInput());
}
 
开发者ID:rolandoislas,项目名称:drc-sim-client,代码行数:23,代码来源:StageConfigInput.java

示例2: povMoved

import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
@Override
public boolean povMoved(Controller controller, int povCode, PovDirection dir) {
    for(int i = 0; i<this.povDirections.length; i++) {
        this.povDirections[i] = false;
    }
    this.povDirections[dir.ordinal()] = true;                
    return false;
}
 
开发者ID:tonysparks,项目名称:seventh,代码行数:9,代码来源:ControllerInput.java

示例3: pollInputController

import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
private void pollInputController() {
    int input = -1;
    int input_extra = -1;
    int input_type = -1;
    main:
    for (Controller controller : Controllers.getControllers()) {
        if (!controller.getName().equals(this.controllerName))
            continue;
        // Check axes
        for (int axis = 0; axis < 1000; axis++) {
            float ax = controller.getAxis(axis);
            if (ax > .5) {
                input_type = ConfigKeymap.Input.TYPE_AXIS;
                input = axis;
                input_extra = 1; // positive
                break main;
            }
            else if (ax < -.5) {
                input_type = ConfigKeymap.Input.TYPE_AXIS;
                input = axis;
                input_extra = 0; // negative
                break main;
            }
        }
        // Only allow an axis to be set for joystick input.
        // TODO Map all 4(8) axes to allow any input to control the joystick(s). 4 directions per joystick
        if (key.contains("JOYSTICK"))
            break;
        // Check dpad/pov
        for (int pov = 0; pov < 1000; pov++) {
            PovDirection povDirection = controller.getPov(pov);
            if (!povDirection.equals(PovDirection.center)) {
                input_type = ConfigKeymap.Input.TYPE_POV;
                input = pov;
                input_extra = povDirection.ordinal();
                break main;
            }
        }
        // Check buttons
        for (int button = 0; button < 1000; button++) {
            if (controller.getButton(button)) {
                input_type = ConfigKeymap.Input.TYPE_BUTTON;
                input = button;
                break main;
            }
        }
        return;
    }
    if (input < 0)
        return;
    // Save input
    config.putInput(this.key, input_type, input, input_extra);
    config.load();
    config.flush();
    Client.setStage(new StageConfigInput(type, config, key, displayName, controllerName));
}
 
开发者ID:rolandoislas,项目名称:drc-sim-client,代码行数:57,代码来源:StageConfigInput.java

示例4: bindPovButton

import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
public void bindPovButton(PovDirection pov, String name) {
    this.povButtons[pov.ordinal()] = name;
}
 
开发者ID:tonysparks,项目名称:seventh,代码行数:4,代码来源:InputMap.java

示例5: removePovBind

import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
public void removePovBind(PovDirection pov) {
    this.povButtons[pov.ordinal()] = null;
}
 
开发者ID:tonysparks,项目名称:seventh,代码行数:4,代码来源:InputMap.java

示例6: isPovDirectionDown

import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
/**
 * @param dir
 * @return true if the supplied {@link PovDirection} is down
 */
public boolean isPovDirectionDown(PovDirection dir) {
    return povDirections[dir.ordinal()];
}
 
开发者ID:tonysparks,项目名称:seventh,代码行数:8,代码来源:ControllerInput.java


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