/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
//check for input
background.Update(gameTime);
//get input
float[] R = new float[9];
SensorManager.GetRotationMatrix(R, null, Activity1.accelValues, Activity1.magnetoValues);
float[] orientation = new float[9];
SensorManager.GetOrientation(R, orientation);
float roll = (float)Java.Lang.Math.ToDegrees(orientation[2]);
touchCollection = TouchPanel.GetState();
TouchLocation[] touches = new TouchLocation[touchCollection.Count];
for (int i = 0; i < touchCollection.Count; i++)
{
touches[i] = new TouchLocation(touchCollection[i].Id, touchCollection[i].State, touchCollection[i].Position * Game1.screenSize / new Vector2(Window.ClientBounds.Width, Window.ClientBounds.Height));
}
switch (state)
{
case GameState.Start:
startScreen.Update(touches, Window);
break;
case GameState.Playing:
level.Update(gameTime, touches, roll);
pauseScreen.Update(touches, Window);
break;
case GameState.End:
endScreen.Update(touches, Window); break;
}
}