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


Java PovDirection.center方法代码示例

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


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

示例3: 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

示例4: 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

示例5: 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

示例6: testForPov

import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
private int testForPov(Controller c) {
	if (c == null) {
		System.out.println("NULL CONTROLLER");
		return -1;
	}
	if (c.getPov(0) != PovDirection.center)
		return 1;
	// DebugOutput.info(this, c.getPov(0)+ " ");
	return -1;
}
 
开发者ID:underclocker,项目名称:Blob-Game,代码行数:11,代码来源:MenuView.java

示例7: testAxisToAxisMapping

import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
@Test
public void testAxisToAxisMapping() {
    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.center;
    controller.axisValues[0] = .2f;
    controller.axisValues[1] = .6f;
    controller.axisValues[2] = -.2f;
    assertEquals(ControllerMappings.RecordResult.recorded, mappings.recordMapping(controller, 5));
    //next call too fast
    assertEquals(ControllerMappings.RecordResult.not_added, mappings.recordMapping(controller, 6));

    controller.axisValues[0] = .2f;
    controller.axisValues[1] = .1f;
    controller.axisValues[2] = 0;
    assertEquals(ControllerMappings.RecordResult.nothing_done, mappings.recordMapping(controller, 6));

    controller.axisValues[0] = .6f;
    controller.axisValues[1] = .5f;
    controller.axisValues[2] = 0;
    assertEquals(ControllerMappings.RecordResult.recorded, mappings.recordMapping(controller, 6));

    controller.axisValues[0] = .6f;
    controller.axisValues[1] = .5f;
    controller.axisValues[2] = -1;
    assertEquals(ControllerMappings.RecordResult.recorded, mappings.recordMapping(controller, 7));

    assertTrue(mappings.getControllerMapping(controller).checkCompleted());

    System.out.println(mappings.toJson().toJson(JsonWriter.OutputType.json));

    // now check
    TestControllerAdapter controllerAdapter = new TestControllerAdapter(mappings);

    // the digital
    assertTrue(controllerAdapter.axisMoved(controller, 2, .8f));
    assertEquals(7, controllerAdapter.lastEventId);
    assertTrue(controllerAdapter.axisMoved(controller, 2, -.8f));
    assertEquals(7, controllerAdapter.lastEventId);
    assertTrue(controllerAdapter.axisMoved(controller, 2, -.2f));
    assertEquals(7, controllerAdapter.lastEventId);

    assertTrue(controllerAdapter.axisMoved(controller, 1, .8f));
    assertEquals(5, controllerAdapter.lastEventId);

    assertTrue(controllerAdapter.axisMoved(controller, 0, -.9f));
    assertEquals(6, controllerAdapter.lastEventId);

    MappedController mappedController = new MappedController(controller, mappings);
    controller.axisValues[0] = .6f;
    controller.axisValues[1] = .5f;
    controller.axisValues[2] = -.7f;
    assertEquals(.6f, mappedController.getConfiguredAxisValue(6), .01f);
    assertEquals(.5f, mappedController.getConfiguredAxisValue(5), .01f);
    assertEquals(-1f, mappedController.getConfiguredAxisValue(7), .01f);
    assertEquals(0, mappedController.getConfiguredAxisValue(3), .01f);
}
 
开发者ID:MrStahlfelge,项目名称:gdx-controllerutils,代码行数:73,代码来源:ControllerMappingsTest.java

示例8: 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

示例9: testJsonSaveLoad

import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
@Test
public void testJsonSaveLoad() {
    ControllerMappings mappings = new ControllerMappings();

    mappings.addConfiguredInput(new ConfiguredInput(ConfiguredInput.Type.button, 1));
    mappings.addConfiguredInput(new ConfiguredInput(ConfiguredInput.Type.axis, 2));
    mappings.addConfiguredInput(new ConfiguredInput(ConfiguredInput.Type.axis, 3));
    mappings.addConfiguredInput(new ConfiguredInput(ConfiguredInput.Type.axis, 4));

    mappings.commitConfig();

    // now we connect a Controller... and map
    MockedController controller = new MockedController();
    controller.axisValues = new float[3];
    controller.povDirection = PovDirection.center;
    controller.axisValues[0] = 1f;
    controller.pressedButton = -1;
    assertEquals(ControllerMappings.RecordResult.recorded, mappings.recordMapping(controller, 2));
    controller.pressedButton = 2;
    assertEquals(ControllerMappings.RecordResult.recorded, mappings.recordMapping(controller, 1));
    controller.pressedButton = 1;
    assertEquals(ControllerMappings.RecordResult.need_second_button, mappings.recordMapping(controller, 3));
    controller.pressedButton = 0;
    assertEquals(ControllerMappings.RecordResult.recorded, mappings.recordMapping(controller, 3));
    controller.pressedButton = -1;
    controller.povDirection = PovDirection.east;
    assertEquals(ControllerMappings.RecordResult.recorded, mappings.recordMapping(controller, 4));

    JsonValue json = mappings.toJson();
    System.out.println(json.toJson(JsonWriter.OutputType.json));
    MappedController mappedController = new MappedController(controller, mappings);
    mappings.resetMappings(controller);

    mappedController.refreshMappingCache();
    assertEquals(0, mappedController.getConfiguredAxisValue(4), 0.1f);

    mappings.fillFromJson(json);
    mappedController.refreshMappingCache();

    assertEquals(1, mappedController.getConfiguredAxisValue(4), 0.1f);
    controller.pressedButton = 2;
    assertTrue(mappedController.isButtonPressed(1));
    controller.pressedButton = 1;
    assertEquals(1, mappedController.getConfiguredAxisValue(3), 0.1f);
}
 
开发者ID:MrStahlfelge,项目名称:gdx-controllerutils,代码行数:46,代码来源:ControllerMappingsTest.java

示例10: getPov

import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
@Override
public PovDirection getPov(int povCode) {
    return (povCode != 0 ? PovDirection.center : povDirection);
}
 
开发者ID:MrStahlfelge,项目名称:gdx-controllerutils,代码行数:5,代码来源:ControllerMappingsTest.java

示例11: getPov

import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
@Override
public PovDirection getPov(int povCode) {
    return PovDirection.center;
}
 
开发者ID:konsoletyper,项目名称:teavm-libgdx,代码行数:5,代码来源:TeaVMController.java

示例12: getPov

import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
@Override
public PovDirection getPov (int povIndex) {
	return PovDirection.center;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:AndroidController.java

示例13: getPov

import com.badlogic.gdx.controllers.PovDirection; //导入方法依赖的package包/类
@Override
public PovDirection getPov(int povCode) {
	return PovDirection.center;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:GwtController.java


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