public override void Initialize() { base.Initialize(); var viewListener = new ViewListener(this); gameView = Game.Context.Control; gameView.SetOnTouchListener(viewListener); gameView.SetOnKeyListener(viewListener); gameView.Resize += GameViewOnResize; GameViewOnResize(null, EventArgs.Empty); // Get the android sensors sensorManager = (SensorManager)PlatformAndroid.Context.GetSystemService(Context.SensorService); androidAccelerometer = sensorManager.GetDefaultSensor(SensorType.Accelerometer); androidGyroscope = sensorManager.GetDefaultSensor(SensorType.Gyroscope); androidUserAcceleration = sensorManager.GetDefaultSensor(SensorType.LinearAcceleration); androidGravity = sensorManager.GetDefaultSensor(SensorType.Gravity); androidRotationVector = sensorManager.GetDefaultSensor(SensorType.RotationVector); // Determine which sensor is available on the device Accelerometer.IsSupported = androidAccelerometer != null; Compass.IsSupported = androidRotationVector != null; Gyroscope.IsSupported = androidGyroscope != null; UserAcceleration.IsSupported = androidUserAcceleration != null; Gravity.IsSupported = androidGravity != null; Orientation.IsSupported = androidRotationVector != null; }
public override void Initialize() { var viewListener = new ViewListener(this); gameView = Game.Context.Control; gameView.SetOnTouchListener(viewListener); gameView.SetOnKeyListener(viewListener); gameView.Resize += GameViewOnResize; GameViewOnResize(null, EventArgs.Empty); }