Reverted : Accelerometer was temporarily disabled

This commit is contained in:
Your Name 2024-11-23 22:03:30 +01:00
parent 4f4d09c2ee
commit baa67de290

View File

@ -4,8 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input;
using Microsoft.Devices.Sensors;
//using Microsoft.Devices.Sensors;
using Microsoft.Xna.Framework.Input.Touch; using Microsoft.Xna.Framework.Input.Touch;
using WindowsPhoneSpeedyBlupi; using WindowsPhoneSpeedyBlupi;
@ -27,7 +26,7 @@ namespace WindowsPhoneSpeedyBlupi
private readonly List<Def.ButtonGlygh> pressedGlyphs; private readonly List<Def.ButtonGlygh> pressedGlyphs;
//private readonly Accelerometer accelSensor; private readonly Accelerometer accelSensor;
private readonly Slider accelSlider; private readonly Slider accelSlider;
@ -215,17 +214,17 @@ namespace WindowsPhoneSpeedyBlupi
this.sound = sound; this.sound = sound;
this.gameData = gameData; this.gameData = gameData;
pressedGlyphs = new List<Def.ButtonGlygh>(); pressedGlyphs = new List<Def.ButtonGlygh>();
//accelSensor = new Accelerometer(); accelSensor = new Accelerometer();
//((SensorBase<AccelerometerReading>)(object)accelSensor).CurrentValueChanged += HandleAccelSensorCurrentValueChanged; ((SensorBase<AccelerometerReading>)(object)accelSensor).CurrentValueChanged += HandleAccelSensorCurrentValueChanged;
//accelSlider = new Slider accelSlider = new Slider
//{ {
// TopLeftCorner = new TinyPoint TopLeftCorner = new TinyPoint
// { {
// X = 320, X = 320,
// Y = 400 Y = 400
// }, },
// Value = this.gameData.AccelSensitivity Value = this.gameData.AccelSensitivity
//}; };
lastButtonDown = Def.ButtonGlygh.None; lastButtonDown = Def.ButtonGlygh.None;
buttonPressed = Def.ButtonGlygh.None; buttonPressed = Def.ButtonGlygh.None;
} }
@ -828,69 +827,69 @@ namespace WindowsPhoneSpeedyBlupi
private void StartAccel() private void StartAccel()
{ {
//try try
//{ {
// accelSensor.Start(); accelSensor.Start();
// accelStarted = true; accelStarted = true;
//} }
//catch (AccelerometerFailedException) catch (AccelerometerFailedException)
//{ {
// accelStarted = false; accelStarted = false;
//} }
//catch (UnauthorizedAccessException) catch (UnauthorizedAccessException)
//{ {
// accelStarted = false; accelStarted = false;
//} }
} }
private void StopAccel() private void StopAccel()
{ {
//if (accelStarted) if (accelStarted)
//{ {
// try try
// { {
// accelSensor.Stop(); accelSensor.Stop();
// } }
// catch (AccelerometerFailedException) catch (AccelerometerFailedException)
// { {
// } }
// accelStarted = false; accelStarted = false;
//} }
} }
//private void HandleAccelSensorCurrentValueChanged(object sender, SensorReadingEventArgs<AccelerometerReading> e) private void HandleAccelSensorCurrentValueChanged(object sender, SensorReadingEventArgs<AccelerometerReading> e)
//{ {
// //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references)
// //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references)
// AccelerometerReading sensorReading = e.SensorReading; AccelerometerReading sensorReading = e.SensorReading;
// float y = ((AccelerometerReading)(ref sensorReading)).Acceleration.Y; float y = ((AccelerometerReading)(ref sensorReading)).Acceleration.Y;
// float num = (1f - (float)gameData.AccelSensitivity) * 0.06f + 0.04f; float num = (1f - (float)gameData.AccelSensitivity) * 0.06f + 0.04f;
// float num2 = (accelLastState ? (num * 0.6f) : num); float num2 = (accelLastState ? (num * 0.6f) : num);
// if (y > num2) if (y > num2)
// { {
// accelSpeedX = 0.0 - Math.Min((double)y * 0.25 / (double)num + 0.25, 1.0); accelSpeedX = 0.0 - Math.Min((double)y * 0.25 / (double)num + 0.25, 1.0);
// } }
// else if (y < 0f - num2) else if (y < 0f - num2)
// { {
// accelSpeedX = Math.Min((double)(0f - y) * 0.25 / (double)num + 0.25, 1.0); accelSpeedX = Math.Min((double)(0f - y) * 0.25 / (double)num + 0.25, 1.0);
// } }
// else else
// { {
// accelSpeedX = 0.0; accelSpeedX = 0.0;
// } }
// accelLastState = accelSpeedX != 0.0; accelLastState = accelSpeedX != 0.0;
// if (accelWaitZero) if (accelWaitZero)
// { {
// if (accelSpeedX == 0.0) if (accelSpeedX == 0.0)
// { {
// accelWaitZero = false; accelWaitZero = false;
// } }
// else else
// { {
// accelSpeedX = 0.0; accelSpeedX = 0.0;
// } }
// } }
//} }
} }
} }