本文整理汇总了Java中com.badlogic.gdx.controllers.PovDirection.southWest方法的典型用法代码示例。如果您正苦于以下问题:Java PovDirection.southWest方法的具体用法?Java PovDirection.southWest怎么用?Java PovDirection.southWest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.controllers.PovDirection
的用法示例。
在下文中一共展示了PovDirection.southWest方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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.
}
示例2: 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.
}
示例3: 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;
}
示例4: 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;
}
}
示例5: testPovToAxisMapping
import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
@Test
public void testPovToAxisMapping() {
ControllerMappings mappings = new ControllerMappings();
// We test 3 axis
ConfiguredInput axis1 = new ConfiguredInput(ConfiguredInput.Type.axis, 5);
ConfiguredInput axis2 = new ConfiguredInput(ConfiguredInput.Type.axisAnalog, 6);
ConfiguredInput axis3 = new ConfiguredInput(ConfiguredInput.Type.axisDigital, 7);
mappings.addConfiguredInput(axis1);
mappings.addConfiguredInput(axis2);
mappings.addConfiguredInput(axis3);
// ok, configuration done...
mappings.commitConfig();
// now we connect a Controller... and map
MockedController controller = new MockedController();
controller.axisValues = new float[3];
controller.povDirection = PovDirection.east;
assertEquals(ControllerMappings.RecordResult.recorded, mappings.recordMapping(controller, 5));
//next call too fast
assertEquals(ControllerMappings.RecordResult.not_added, mappings.recordMapping(controller, 7));
//not two directions
controller.povDirection = PovDirection.northWest;
assertEquals(ControllerMappings.RecordResult.not_added, mappings.recordMapping(controller, 7));
//not same direction on different configurations
controller.povDirection = PovDirection.west;
assertEquals(ControllerMappings.RecordResult.not_added, mappings.recordMapping(controller, 7));
//not for analog axis
controller.povDirection = PovDirection.north;
assertEquals(ControllerMappings.RecordResult.nothing_done, mappings.recordMapping(controller, 6));
assertEquals(ControllerMappings.RecordResult.recorded, mappings.recordMapping(controller, 7));
assertFalse(mappings.getControllerMapping(controller).checkCompleted());
System.out.println(mappings.toJson().toJson(JsonWriter.OutputType.json));
// now check
TestControllerAdapter controllerAdapter = new TestControllerAdapter(mappings);
assertFalse(controllerAdapter.povMoved(controller, 1, PovDirection.center));
// the digital
assertTrue(controllerAdapter.povMoved(controller, 0, PovDirection.center));
assertTrue(controllerAdapter.lastEventId == 5 || controllerAdapter.lastEventId == 7);
assertTrue(controllerAdapter.povMoved(controller, 0, PovDirection.east));
assertTrue(controllerAdapter.lastEventId == 5 || controllerAdapter.lastEventId == 7);
assertTrue(controllerAdapter.povMoved(controller, 0, PovDirection.southEast));
assertTrue(controllerAdapter.lastEventId == 5 || controllerAdapter.lastEventId == 7);
assertTrue(controllerAdapter.povMoved(controller, 0, PovDirection.west));
assertTrue(controllerAdapter.lastEventId == 5 || controllerAdapter.lastEventId == 7);
MappedController mappedController = new MappedController(controller, mappings);
controller.povDirection = PovDirection.center;
assertEquals(0, mappedController.getConfiguredAxisValue(5), .01f);
assertEquals(0, mappedController.getConfiguredAxisValue(6), .01f);
assertEquals(0, mappedController.getConfiguredAxisValue(7), .01f);
controller.povDirection = PovDirection.north;
assertEquals(0, mappedController.getConfiguredAxisValue(5), .01f);
assertEquals(0, mappedController.getConfiguredAxisValue(6), .01f);
assertEquals(-1, mappedController.getConfiguredAxisValue(7), .01f);
controller.povDirection = PovDirection.east;
assertEquals(1, mappedController.getConfiguredAxisValue(5), .01f);
assertEquals(0, mappedController.getConfiguredAxisValue(6), .01f);
assertEquals(0, mappedController.getConfiguredAxisValue(7), .01f);
controller.povDirection = PovDirection.southWest;
assertEquals(-1, mappedController.getConfiguredAxisValue(5), .01f);
assertEquals(0, mappedController.getConfiguredAxisValue(6), .01f);
assertEquals(1, mappedController.getConfiguredAxisValue(7), .01f);
}
示例6: unmappedButtonPressed
import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
@Override
protected boolean unmappedButtonPressed(int unmappedButtonNr) {
boolean pressed = false;
Array<com.badlogic.gdx.controllers.Controller> controllers = Controllers.getControllers();
for(int i=controllers.size-1; i>=0; i--) {
com.badlogic.gdx.controllers.Controller c = controllers.get(i);
int povCode = 0;
switch(unmappedButtonNr) {
case POV_CENTER:
// this needs to disable all pov-buttons
pressed = false; // center can't be pressed
break;
case POV_NORTH:
pressed |= c.getPov(povCode) == PovDirection.north;
break;
case POV_NORTHEAST:
pressed |= c.getPov(povCode) == PovDirection.northEast;
break;
case POV_EAST:
pressed |= c.getPov(povCode) == PovDirection.east;
break;
case POV_SOUTHEAST:
pressed |= c.getPov(povCode) == PovDirection.southEast;
break;
case POV_SOUTH:
pressed |= c.getPov(povCode) == PovDirection.south;
break;
case POV_SOUTHWEST:
pressed |= c.getPov(povCode) == PovDirection.southWest;
break;
case POV_WEST:
pressed |= c.getPov(povCode) == PovDirection.west;
break;
case POV_NORTHWEST:
pressed |= c.getPov(povCode) == PovDirection.northWest;
break;
case BUTTON1:
pressed |= c.getButton(0);
break;
case BUTTON2:
pressed |= c.getButton(1);
break;
case BUTTON3:
pressed |= c.getButton(2);
break;
case BUTTON4:
pressed |= c.getButton(3);
break;
case BUTTON5:
pressed |= c.getButton(4);
break;
case BUTTON6:
pressed |= c.getButton(5);
break;
case BUTTON7:
pressed |= c.getButton(6);
break;
case BUTTON8:
pressed |= c.getButton(7);
break;
}
}
return pressed;
}