package net.mgsx.rainstick.systems;

import com.badlogic.ashley.core.EntitySystem;
import com.badlogic.gdx.Gdx;

import net.mgsx.game.core.GamePipeline;
import net.mgsx.game.plugins.box2d.systems.Box2DWorldSystem;

public class GyroSystem extends EntitySystem
{
	public GyroSystem() {
		super(GamePipeline.BEFORE_PHYSICS);
	}
	
	@Override
	public void update(float deltaTime) {
		float gx = Gdx.input.getAccelerometerY();
		float gy = -Gdx.input.getAccelerometerX();
		
		getEngine().getSystem(Box2DWorldSystem.class).gravity.set(gx, gy);
	}
}

@@ -104,16 +104,58 @@
 gdx.Gdx;
+%0Aimport com.badlogic.gdx.Input.Peripheral;
 %0A%0Aimport
@@ -413,16 +413,82 @@
 Time) %7B%0A
+%09%09if(Gdx.input.isPeripheralAvailable(Peripheral.Accelerometer))%7B%0A%09
 %09%09float 
@@ -523,16 +523,17 @@
 terY();%0A
+%09
 %09%09float 
@@ -571,18 +571,16 @@
 rX();%0A%09%09
-%0A%09
 %09getEngi
@@ -639,13 +639,17 @@
 x, gy);%0A
+%09%09%7D%0A
 %09%7D%0A%7D%0A

enable gyro only with capable device