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


Java Peripheral类代码示例

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


Peripheral类属于com.badlogic.gdx.Input包,在下文中一共展示了Peripheral类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
@Override
public void create() {
	// Preferences
	preferences = Gdx.app.getPreferences("prefs");
	
	scale = findScale();
	
	// Loading global textures
	buttons = new Texture(Gdx.files
			.internal("buttons/buttons.png"));
	if (!Gdx.input.isPeripheralAvailable(Peripheral.Compass)) {
		this.setScreen(new NoCompassScreen(scale));
	} else {
		mainMenu = new MainMenuScreen(this);
		this.setScreen(mainMenu);
	}
}
 
开发者ID:raatmarien,项目名称:Point-and-Hit,代码行数:18,代码来源:OneShotGame.java

示例2: getCurrentStaticValues

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
/**
 * Copies the {@link StaticProperties} from the current {@link Gdx libGdx}
 * environment.
 * 
 * @return the {@link StaticProperties} of the current environment
 */
public static StaticProperties getCurrentStaticValues() {
	StaticProperties result = new StaticProperties();
	result.accelerometerAvailable = Gdx.input
			.isPeripheralAvailable(Peripheral.Accelerometer);
	result.compassAvailable = Gdx.input
			.isPeripheralAvailable(Peripheral.Compass);
	result.keyboardAvailable = Gdx.input
			.isPeripheralAvailable(Peripheral.HardwareKeyboard);
	result.onscreenKeyboard = Gdx.input
			.isPeripheralAvailable(Peripheral.OnscreenKeyboard);
	result.vibrator = Gdx.input.isPeripheralAvailable(Peripheral.Vibrator);
	result.hasMultitouch = Gdx.input
			.isPeripheralAvailable(Peripheral.MultitouchScreen);
	result.nativeOrientation = Gdx.input.getNativeOrientation();
	return result;
}
 
开发者ID:suluke,项目名称:gdx.automation,代码行数:23,代码来源:InputProperty.java

示例3: show

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
@Override
public void show() {
	super.show();
	mTexture = new Texture(Gdx.files.internal("textures/player.png"));
	mPlayerTexture = new TextureRegion(mTexture, 0, 0, 64, 64);
	
	mFont = new BitmapFont();
	mFont.setColor(1.0f, 0.5f, 1.0f, 1.0f);
	
	// TODO: Change input based on settings
	if ((Gdx.app.getType() == ApplicationType.Android) && (Gdx.input.isPeripheralAvailable(Peripheral.Accelerometer))) {
		mUsePolling = true;
	} else {
		mUsePolling = false;						
	}
	mInputManager = new InputManager(mGame, mLevel, mPlayer);
	Gdx.input.setInputProcessor(mInputManager);
}
 
开发者ID:dbaelz,项目名称:Secludedness,代码行数:19,代码来源:LevelScreen.java

示例4: isPeripheralAvailable

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
public final boolean isPeripheralAvailable(Input.Peripheral paramPeripheral)
{
  boolean bool = true;
  if (paramPeripheral == Input.Peripheral.Accelerometer)
    bool = this.accelerometerAvailable;
  do
  {
    do
    {
      return bool;
      if (paramPeripheral == Input.Peripheral.Compass)
        return this.compassAvailable;
      if (paramPeripheral == Input.Peripheral.HardwareKeyboard)
        return this.keyboardAvailable;
    }
    while (paramPeripheral == Input.Peripheral.OnscreenKeyboard);
    if (paramPeripheral != Input.Peripheral.Vibrator)
      break;
  }
  while (this.vibrator != null);
  return false;
  if (paramPeripheral == Input.Peripheral.MultitouchScreen)
    return this.hasMultitouch;
  return false;
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:26,代码来源:AndroidInput.java

示例5: RemoteSender

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
public RemoteSender(String paramString, int paramInt)
{
  try
  {
    Socket localSocket = new Socket(paramString, paramInt);
    localSocket.setTcpNoDelay(true);
    localSocket.setSoTimeout(3000);
    this.out = new DataOutputStream(localSocket.getOutputStream());
    this.out.writeBoolean(Gdx.input.isPeripheralAvailable(Input.Peripheral.MultitouchScreen));
    this.connected = true;
    Gdx.input.setInputProcessor(this);
    return;
  }
  catch (Exception localException)
  {
    Gdx.app.log("RemoteSender", "couldn't connect to " + paramString + ":" + paramInt);
  }
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:19,代码来源:RemoteSender.java

示例6: RemoteSender

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
public RemoteSender (String ip, int port) {
	try {
		Socket socket = new Socket(ip, port);
		socket.setTcpNoDelay(true);
		socket.setSoTimeout(3000);
		out = new DataOutputStream(socket.getOutputStream());
		out.writeBoolean(Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen));
		connected = true;
		Gdx.input.setInputProcessor(this);
	} catch (Exception e) {
		Gdx.app.log("RemoteSender", "couldn't connect to " + ip + ":" + port);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:14,代码来源:RemoteSender.java

示例7: create

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
@Override
public void create () {
	Gdx.app.log("Multitouch", "multitouch supported: " + Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen));
	renderer = new ShapeRenderer();
	camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	camera.position.set(Gdx.graphics.getWidth() / 2.0f, Gdx.graphics.getHeight() / 2.0f, 0);
	Gdx.input.setInputProcessor(this);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:9,代码来源:MultitouchTest.java

示例8: getAccelerometerState

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
@Override
public boolean getAccelerometerState() {
	if (prefs.contains("Accelerometer")) {
		return prefs.getBoolean("Accelerometer");
	}
	boolean isPossible = Gdx.input.isPeripheralAvailable(Peripheral.Accelerometer);
	prefs.putBoolean("Accelerometer", isPossible);
	prefs.flush();
	return isPossible;
}
 
开发者ID:PhilippGrulich,项目名称:HAW-SE2-projecthorse,代码行数:11,代码来源:SettingsImpl.java

示例9: setUI

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
@Override
public void setUI(final UI ui) {
	this.ui = ui;

	recorder = ui.getRecorder();
	testerBot = ui.getTesterBot();

	pie = new PieMenu(this);
	textManagerUI = new TextManagerUI(ui.getSkin());
	menuButton = new Button(ui.getSkin(), "menu");
	dialogUI = new DialogUI(ui);
	pointer = new ScenePointer(ui.getSkin());
	inventoryUI = new InventoryUI(this, pointer);
	inventoryButton = new InventoryButton(ui.getSkin(), inventoryUI);

	uiMode = UIModes.valueOf(Config.getProperty(Config.UI_MODE, "TWO_BUTTONS").toUpperCase(Locale.ENGLISH));

	if (Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen) && uiMode == UIModes.TWO_BUTTONS) {
		uiMode = UIModes.PIE;
	}

	pie.setVisible(false);

	menuButton.addListener(new ClickListener() {
		public void clicked(InputEvent event, float x, float y) {
			ui.setCurrentScreen(Screens.MENU_SCREEN);
		}
	});

	retrieveAssets(ui.getUIAtlas());

	stage = new Stage(viewport);
	stage.addActor(textManagerUI);
	stage.addActor(dialogUI);
	stage.addActor(inventoryButton);
	stage.addActor(menuButton);
	stage.addActor(inventoryUI);
	stage.addActor(pie);
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:40,代码来源:DefaultSceneScreen.java

示例10: draw

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
public void draw(SpriteBatch batch, Viewport v) {

		getInputUnproject(v, mousepos);

		boolean multiTouch = Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen);

		// DRAW TARGET DESCRIPTION
		if (desc != null && (!multiTouch || Gdx.input.isTouched())) {
			float margin = DPIUtils.UI_SPACE;

			float textX = mousepos.x - layout.width / 2;
			float textY = mousepos.y + layout.height + DPIUtils.UI_SPACE + DPIUtils.getTouchMinSize();

			if (textX < 0)
				textX = 0;

			RectangleRenderer.draw(batch, textX - margin, textY - layout.height - margin, layout.width + margin * 2,
					layout.height + margin * 2, Color.BLACK);
			font.draw(batch, layout, textX, textY);
		}

		if (draggingActor == null) {
			if (!multiTouch || currentIcon == leaveIcon) {

				batch.draw(currentIcon, mousepos.x - currentIcon.getRegionWidth() / 2,
						mousepos.y - currentIcon.getRegionHeight() / 2, currentIcon.getRegionWidth() / 2,
						currentIcon.getRegionHeight() / 2, currentIcon.getRegionWidth(), currentIcon.getRegionHeight(),
						pointerScale, pointerScale, currentIcon == leaveIcon ? leaveRotation : 0);
			}
		} else {
			float h = (draggingActor.getHeight() > draggingActor.getWidth() ? draggingActor.getHeight()
					: draggingActor.getWidth());
			float size = DPIUtils.getTouchMinSize() / h * 1.8f;

			ActorRenderer r = draggingActor.getRenderer();

			r.draw(batch, mousepos.x, mousepos.y - draggingActor.getHeight() * size / 2, size, 0f,
					currentIcon != hotspotIcon ? tmpTint : draggingActor.getTint());
		}
	}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:41,代码来源:ScenePointer.java

示例11: show

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
@Override
public void show() {
	final Locale locale = I18N.getCurrentLocale();
	String filename = null;
	UIModes uiMode = UIModes.valueOf(Config.getProperty(Config.UI_MODE, "TWO_BUTTONS").toUpperCase(Locale.ENGLISH));

	if (Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen) && uiMode == UIModes.TWO_BUTTONS) {
		uiMode = UIModes.PIE;
	}

	switch (uiMode) {
	case PIE:
		filename = PIE_FILENAME;
		break;
	case SINGLE_CLICK:
		filename = SINGLE_CLICK_FILENAME;
		break;
	case TWO_BUTTONS:
		filename = TWO_BUTTONS_FILENAME;
		break;

	}

	localeFilename = MessageFormat.format("{0}_{1}.png", filename, locale.getLanguage());

	if (!EngineAssetManager.getInstance().assetExists(localeFilename))
		localeFilename = MessageFormat.format("{0}.png", filename);

	tex = new Texture(EngineAssetManager.getInstance().getResAsset(localeFilename));
	tex.setFilter(TextureFilter.Linear, TextureFilter.Linear);

	Gdx.input.setInputProcessor(inputProcessor);
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:34,代码来源:HelpScreen.java

示例12: show

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
public void show() {	
	if(!Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen)) {
		setVisible(true);
	} else {
		setVisible(false);
	}
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:8,代码来源:Pointer.java

示例13: create

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
@Override
	public void create() {
//		Gdx.input
//				.setInputProcessor(new GestureDetector(new MyGestureListener(this)));

		Gdx.input.setInputProcessor(new InputHandler(this));
		
		batch = new SpriteBatch();
		img = new Texture("badlogic.jpg");
		available = Gdx.input.isPeripheralAvailable(Peripheral.Accelerometer);
	}
 
开发者ID:pt2121,项目名称:GlassSensorTest,代码行数:12,代码来源:TestSensor.java

示例14: isPeripheralAvailable

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
public boolean isPeripheralAvailable(Input.Peripheral paramPeripheral)
{
  if (paramPeripheral == Input.Peripheral.Accelerometer);
  while (paramPeripheral == Input.Peripheral.Compass)
    return true;
  if (paramPeripheral == Input.Peripheral.MultitouchScreen)
    return this.multiTouch;
  return false;
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:10,代码来源:RemoteInput.java

示例15: initialize

import com.badlogic.gdx.Input.Peripheral; //导入依赖的package包/类
public void initialize(AssetManager assetManager) {
    camera = new PerspectiveCamera(GlobalConf.scene.CAMERA_FOV, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera.near = (float) CAM_NEAR;
    camera.far = (float) CAM_FAR;

    // init cameras vector
    cameras = new PerspectiveCamera[] { camera, camLeft, camRight };

    fovFactor = camera.fieldOfView / 40f;

    up = new Vector3d(1, 0, 0);
    direction = new Vector3d(0, 1, 0);
    focusDirection = new Vector3d();
    desired = new Vector3d();
    pitch = new Vector3d(0.0f, 0.0f, -3.0291599E-6f);
    yaw = new Vector3d(0.0f, 0.0f, -7.9807205E-6f);
    roll = new Vector3d(0.0f, 0.0f, -1.4423944E-4f);
    horizontal = new Vector3d();
    vertical = new Vector3d();

    friction = new Vector3d();
    lastvel = new Vector3d();
    focusPos = new Vector3d();

    aux1 = new Vector3d();
    aux2 = new Vector3d();
    aux3 = new Vector3d();
    aux4 = new Vector3d();
    aux5 = new Vector3d();
    auxf1 = new Vector3();
    aux2f2 = new Vector2();

    dx = new Vector3d();

    accelerometer = Gdx.input.isPeripheralAvailable(Peripheral.Accelerometer);

    inputController = new NaturalInputController(this);
    controllerListener = new NaturalControllerListener(this, GlobalConf.controls.CONTROLLER_MAPPINGS_FILE);

    // Init sprite batch for crosshair
    spriteBatch = new SpriteBatch();

    // Focus crosshair
    focusCrosshair = new Texture(Gdx.files.internal("img/crosshair-green.png"));
    focusCrosshair.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    // Focus arrow
    focusArrow = new Texture(Gdx.files.internal("img/crosshair-green-arrow.png"));
    focusArrow.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    // Velocity vector crosshair
    velocityCrosshair = new Texture(Gdx.files.internal("img/ai-vel.png"));
    velocityCrosshair.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    // Antivelocity vector crosshair
    antivelocityCrosshair = new Texture(Gdx.files.internal("img/ai-antivel.png"));
    antivelocityCrosshair.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    // Speed HUD
    Texture sHUD = new Texture(Gdx.files.internal("img/hud-corners.png"));
    sHUD.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    hudw = sHUD.getWidth();
    hudh = sHUD.getHeight();

    hudScales = new double[] { HUD_SCALE_MIN, HUD_SCALE_MIN + (HUD_SCALE_MAX - HUD_SCALE_MIN) / 3d, HUD_SCALE_MIN + (HUD_SCALE_MAX - HUD_SCALE_MIN) * 2d / 3d };
    hudSprites = new Sprite[hudScales.length];
    hudColors = new Color[] { Color.WHITE, Color.GREEN, Color.GOLD, Color.LIME, Color.PINK, Color.ORANGE, Color.CORAL, Color.CYAN, Color.FIREBRICK, Color.FOREST };

    for (int i = 0; i < hudScales.length; i++) {
        hudSprites[i] = new Sprite(sHUD);
        hudSprites[i].setOriginCenter();
    }

    // Focus is changed from GUI
    EventManager.instance.subscribe(this, Events.FOCUS_CHANGE_CMD, Events.FOV_CHANGED_CMD, Events.ORIENTATION_LOCK_CMD, Events.CAMERA_POS_CMD, Events.CAMERA_DIR_CMD, Events.CAMERA_UP_CMD, Events.CAMERA_FWD, Events.CAMERA_ROTATE, Events.CAMERA_PAN, Events.CAMERA_ROLL, Events.CAMERA_TURN, Events.CAMERA_STOP, Events.CAMERA_CENTER, Events.GO_TO_OBJECT_CMD, Events.PLANETARIUM_FOCUS_ANGLE_CMD, Events.PLANETARIUM_CMD);
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:77,代码来源:NaturalCamera.java


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