@Override public float getAccelerometerZ () { return input.getAccelerometerZ(); }
public void sendUpdate () { synchronized (this) { if (!connected) return; } try { out.writeInt(ACCEL); out.writeFloat(Gdx.input.getAccelerometerX()); out.writeFloat(Gdx.input.getAccelerometerY()); out.writeFloat(Gdx.input.getAccelerometerZ()); out.writeInt(COMPASS); out.writeFloat(Gdx.input.getAzimuth()); out.writeFloat(Gdx.input.getPitch()); out.writeFloat(Gdx.input.getRoll()); out.writeInt(SIZE); out.writeFloat(Gdx.graphics.getWidth()); out.writeFloat(Gdx.graphics.getHeight()); out.writeInt(GYRO); out.writeFloat(Gdx.input.getGyroscopeX()); out.writeFloat(Gdx.input.getGyroscopeY()); out.writeFloat(Gdx.input.getGyroscopeZ()); } catch (Throwable t) { out = null; connected = false; } }
public void sendUpdate () { synchronized (this) { if (!connected) return; } try { out.writeInt(ACCEL); out.writeFloat(Gdx.input.getAccelerometerX()); out.writeFloat(Gdx.input.getAccelerometerY()); out.writeFloat(Gdx.input.getAccelerometerZ()); out.writeInt(COMPASS); out.writeFloat(Gdx.input.getAzimuth()); out.writeFloat(Gdx.input.getPitch()); out.writeFloat(Gdx.input.getRoll()); out.writeInt(SIZE); out.writeFloat(Gdx.graphics.getWidth()); out.writeFloat(Gdx.graphics.getHeight()); out.writeInt(GYRO); out.writeFloat(Gdx.input.getGyroscopeX()); out.writeFloat(Gdx.input.getGyroscopeY()); out.writeFloat(Gdx.input.getGyroscopeZ()); } catch (Throwable t) { out = null; connected = false; } }
@Override public void render () { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); font.draw(batch, "accel: [" + Gdx.input.getAccelerometerX() + "," + Gdx.input.getAccelerometerY() + "," + Gdx.input.getAccelerometerZ() + "]\n" + "orientation: " + Gdx.input.getNativeOrientation() + "\n" + "rotation: " + Gdx.input.getRotation() + "\n" + "wh: " + Gdx.graphics.getDisplayMode() + "\n", 0, 100); batch.end(); }
public float getAccelZ() { if (isSensorActive) { return Gdx.input.getAccelerometerZ(); } else { return 0.0f; } }
public void sendUpdate () { synchronized (this) { if (!connected) return; } try { out.writeInt(ACCEL); out.writeFloat(Gdx.input.getAccelerometerX()); out.writeFloat(Gdx.input.getAccelerometerY()); out.writeFloat(Gdx.input.getAccelerometerZ()); out.writeInt(COMPASS); out.writeFloat(Gdx.input.getAzimuth()); out.writeFloat(Gdx.input.getPitch()); out.writeFloat(Gdx.input.getRoll()); out.writeInt(SIZE); out.writeFloat(Gdx.graphics.getWidth()); out.writeFloat(Gdx.graphics.getHeight()); out.writeInt(GYRO); out.writeFloat(Gdx.input.getGyroscopeX()); out.writeFloat(Gdx.input.getGyroscopeY()); out.writeFloat(Gdx.input.getGyroscopeZ()); } catch (Throwable t) { out = null; connected = false; } }
float zAxis = Gdx.input.getAccelerometerZ();
float accelerometerZ = Gdx.input.getAccelerometerZ(); font.draw(batch, "Accelerometer x=" + accelerometerX, 20.0f, SCENE_HEIGHT - 300.0f); font.draw(batch, "Accelerometer y=" + accelerometerY, 20.0f, SCENE_HEIGHT - 330.0f);