mirror of
https://github.com/openeggbert/mobile-eggbert-monogame-desktop.git
synced 2025-03-26 16:09:24 +01:00
Accelerometer was temporarily disabled
This commit is contained in:
parent
cac8a39341
commit
0627affd67
140
InputPad.cs
140
InputPad.cs
@ -3,7 +3,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Devices.Sensors;
|
//using Microsoft.Devices.Sensors;
|
||||||
using Microsoft.Xna.Framework.Input.Touch;
|
using Microsoft.Xna.Framework.Input.Touch;
|
||||||
using WindowsPhoneSpeedyBlupi;
|
using WindowsPhoneSpeedyBlupi;
|
||||||
|
|
||||||
@ -25,7 +25,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;
|
||||||
|
|
||||||
@ -213,17 +213,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;
|
||||||
}
|
}
|
||||||
@ -805,69 +805,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;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user