本文整理汇总了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());
}
示例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;
}
示例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.
}
示例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;
}
示例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.
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}