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


Java PovDirection类代码示例

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


PovDirection类属于com.badlogic.gdx.controllers包,在下文中一共展示了PovDirection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 value) {
	switch (value) {
		case north:
		case northEast:
		case northWest: {
			keyDown(Keys.UP);
			break;
		}
		case south:
		case southEast:
		case southWest: {
			keyDown(Keys.DOWN);
			break;
		}
		case center: {
			keyUp(Keys.DOWN);
			break;
		}
		default: {
			break;
		}
	}

	return true;
}
 
开发者ID:Quillraven,项目名称:Protoman-vs-Megaman,代码行数:27,代码来源:GSGameLogic.java

示例3: getPov

import com.badlogic.gdx.controllers.PovDirection; //导入依赖的package包/类
public PovDirection getPov (int povIndex) {
	OisPov pov = joystick.getPov(povIndex);
	switch (pov) {
	case Centered:
		return PovDirection.center;
	case East:
		return PovDirection.east;
	case North:
		return PovDirection.north;
	case NorthEast:
		return PovDirection.northEast;
	case NorthWest:
		return PovDirection.northWest;
	case South:
		return PovDirection.south;
	case SouthEast:
		return PovDirection.southEast;
	case SouthWest:
		return PovDirection.southWest;
	case West:
		return PovDirection.west;
	}
	return null; // Impossible.
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:25,代码来源:OisControllers.java

示例4: testForBindingController

import com.badlogic.gdx.controllers.PovDirection; //导入依赖的package包/类
private Controller testForBindingController() {
	for (Controller c : Controllers.getControllers()) {
		for (int i = 0; i < 10; i++) {
			if (c.getButton(i)) {
				return c;
			}
		}
		for (int i = 0; i < 4; i++) {
			if (Math.abs(c.getAxis(i)) > 0.75f) {
				return c;
			}
		}
		if (c.getPov(0) != PovDirection.center)
			return c;
	}
	return null;
}
 
开发者ID:underclocker,项目名称:Blob-Game,代码行数:18,代码来源:MenuView.java

示例5: getPov

import com.badlogic.gdx.controllers.PovDirection; //导入依赖的package包/类
public PovDirection getPov (int povIndex) {
	OisJoystick.OisPov pov = joystick.getPov(povIndex);
	switch (pov) {
		case Centered:
			return PovDirection.center;
		case East:
			return PovDirection.east;
		case North:
			return PovDirection.north;
		case NorthEast:
			return PovDirection.northEast;
		case NorthWest:
			return PovDirection.northWest;
		case South:
			return PovDirection.south;
		case SouthEast:
			return PovDirection.southEast;
		case SouthWest:
			return PovDirection.southWest;
		case West:
			return PovDirection.west;
	}
	return null; // Impossible.
}
 
开发者ID:0x0ade,项目名称:shadow-engine,代码行数:25,代码来源:OisControllers.java

示例6: povMoved

import com.badlogic.gdx.controllers.PovDirection; //导入依赖的package包/类
@Override
public boolean povMoved(Controller controller, int povCode, PovDirection value) {
    switch(value) {
        case north:
            cursorUp();
            break;
        case south:
            cursorDown();
            break;
    }
    return false;
}
 
开发者ID:gradualgames,项目名称:ggvm,代码行数:13,代码来源:PCMenu.java

示例7: povMoved

import com.badlogic.gdx.controllers.PovDirection; //导入依赖的package包/类
@Override
public boolean povMoved(Controller controller, int povCode, PovDirection value) {
    if(controller == pads[0]) {

    }else if(controller == pads[1]) {

    }
    return true;
}
 
开发者ID:elitej13,项目名称:project-divine-intervention,代码行数:10,代码来源:GamePadManager.java

示例8: povMoved

import com.badlogic.gdx.controllers.PovDirection; //导入依赖的package包/类
public boolean povMoved(Controller arg0, int arg1, PovDirection arg2)
{
	//Gdx.app.log("CONTROLLER POV", ""+arg1);
	//Gdx.app.log("CONTROLLER POV", ""+arg2);
	
	if (arg2 == PovDirection.center)
	{
		for (int i = 0; i < mapA.size; i++)
		{
			if (mapA.get(i).controller.equals(arg0))
			{
				controlList[i].getCurrent().releasePov();
			}
		}
	}
	else
	{
		for (int i = 0; i < mapA.size; i++)
		{
			if (mapA.get(i).controller.equals(arg0))
			{
				controlList[i].getCurrent().pressPov(arg2);
			}
		}
	}
	
	return false;
}
 
开发者ID:ChainGangChase,项目名称:cgc-game,代码行数:29,代码来源:InputManager.java

示例9: povMoved

import com.badlogic.gdx.controllers.PovDirection; //导入依赖的package包/类
@Override
public boolean povMoved(Controller controller, int povCode, PovDirection value) {
    // TODO: Handle multiple pov-codes
    //Gdx.app.log("povMoved","LibniReceiver: "+controller.getName()
    //        + " povCode: " + povCode
    //        + " PovDirection: " + value + " ordinal: " + value.ordinal());
    //if(value == PovDirection.center) { // this resets all pov-directions
    // allways update all
        for(int i=0; i<8; i++)
            gdxControllerMultiplexer.registerButtonEvent(i);
    //} else gdxControllerMultiplexer.registerButtonEvent(value.ordinal()-1);
    return false;
}
 
开发者ID:ulno,项目名称:libni,代码行数:14,代码来源:GdxMergedInput.java

示例10: povMoved

import com.badlogic.gdx.controllers.PovDirection; //导入依赖的package包/类
@Override
public boolean povMoved(final Controller controller, final int povIndex, final PovDirection direction) {
    if (isAssignedTo(controller)) {
        if (direction != null) {
            if (direction == PovDirection.center) {
                stop();
            } else {
                movement.x = getX(direction);
                movement.y = getY(direction);
            }
        }
        return true;
    }
    return false;
}
 
开发者ID:BialJam,项目名称:M-M,代码行数:16,代码来源:GamePadControl.java

示例11: getX

import com.badlogic.gdx.controllers.PovDirection; //导入依赖的package包/类
protected float getX(final PovDirection direction) {
    final float x;
    if (invertXY) { // Checking Y axis (north=east, south=west):
        x = getAbsoluteY(direction);
    } else { // Checking X axis:
        x = getAbsoluteX(direction);
    }
    if (invertX) {
        return -x;
    }
    return x;
}
 
开发者ID:BialJam,项目名称:M-M,代码行数:13,代码来源:GamePadControl.java

示例12: getY

import com.badlogic.gdx.controllers.PovDirection; //导入依赖的package包/类
protected float getY(final PovDirection direction) {
    final float y;
    if (invertXY) { // Checking X axis (north=east, south=west):
        y = getAbsoluteX(direction);
    } else { // Checking Y axis:
        y = getAbsoluteY(direction);
    }
    if (invertY) {
        return -y;
    }
    return y;
}
 
开发者ID:BialJam,项目名称:M-M,代码行数:13,代码来源:GamePadControl.java

示例13: getAbsoluteX

import com.badlogic.gdx.controllers.PovDirection; //导入依赖的package包/类
protected float getAbsoluteX(final PovDirection direction) {
    if (direction == PovDirection.east) {
        return 1f;
    } else if (direction == PovDirection.northEast || direction == PovDirection.southEast) {
        return COS;
    } else if (direction == PovDirection.west) {
        return -1f;
    } else if (direction == PovDirection.northWest || direction == PovDirection.southWest) {
        return -COS;
    }
    return 0f;
}
 
开发者ID:BialJam,项目名称:M-M,代码行数:13,代码来源:GamePadControl.java

示例14: getAbsoluteY

import com.badlogic.gdx.controllers.PovDirection; //导入依赖的package包/类
protected float getAbsoluteY(final PovDirection direction) {
    if (direction == PovDirection.north) {
        return 1f;
    } else if (direction == PovDirection.northEast || direction == PovDirection.northWest) {
        return SIN;
    } else if (direction == PovDirection.south) {
        return -1f;
    } else if (direction == PovDirection.southWest || direction == PovDirection.southEast) {
        return -SIN;
    } else {
        return 0f;
    }
}
 
开发者ID:BialJam,项目名称:M-M,代码行数:14,代码来源:GamePadControl.java

示例15: setRotation

import com.badlogic.gdx.controllers.PovDirection; //导入依赖的package包/类
public void setRotation(PovDirection dir){
	switch(dir){
	case east:	rot = -90; break;
	case south: rot = 180; break;
	case west: rot = 90; break;
	default: rot = 0; break;
	}
}
 
开发者ID:JayKEm,项目名称:Aftamath,代码行数:9,代码来源:MenuObj.java


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