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


Java PovDirection.west方法代码示例

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


在下文中一共展示了PovDirection.west方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:25,代码来源:OisControllers.java

示例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.
}
 
开发者ID:0x0ade,项目名称:shadow-engine,代码行数:25,代码来源:OisControllers.java

示例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;
}
 
开发者ID:BialJam,项目名称:M-M,代码行数:13,代码来源:GamePadControl.java

示例4: 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);
}
 
开发者ID:MrStahlfelge,项目名称:gdx-controllerutils,代码行数:82,代码来源:ControllerMappingsTest.java

示例5: 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;
}
 
开发者ID:ulno,项目名称:libni,代码行数:66,代码来源:GdxReceiverMultiplexer.java


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