diff --git a/.gitignore b/.gitignore index bfe682c..c9b8a02 100644 --- a/.gitignore +++ b/.gitignore @@ -241,3 +241,5 @@ ModelManifest.xml # FAKE - F# Make .fake/ rv.keystore + +*.bak diff --git a/AccelerometerAndroidImpl.cs b/AccelerometerAndroidImpl.cs deleted file mode 100644 index afb9e60..0000000 --- a/AccelerometerAndroidImpl.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Devices.Sensors; - -namespace WindowsPhoneSpeedyBlupi -{ - public class AccelerometerAndroidImpl : IAccelerometer - { - public event EventHandler CurrentValueChanged; - - private Accelerometer accelerometer = new Accelerometer(); - public void Start() - { - accelerometer.Start(); - } - - public void Stop() - { - accelerometer.Stop(); - } - } -} diff --git a/AccelerometerDummyImpl.cs b/AccelerometerDummyImpl.cs deleted file mode 100644 index d5036fb..0000000 --- a/AccelerometerDummyImpl.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace WindowsPhoneSpeedyBlupi -{ - public class AccelerometerDummyImpl : IAccelerometer - { - public event EventHandler CurrentValueChanged; - - public void Start() - { - //throw new AccelerometerFailedException(); - } - - public void Stop() - { - //throw new AccelerometerFailedException(); - } - } -} diff --git a/AccelerometerEventArgs.cs b/AccelerometerEventArgs.cs deleted file mode 100644 index e94e01e..0000000 --- a/AccelerometerEventArgs.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace WindowsPhoneSpeedyBlupi -{ - public class AccelerometerEventArgs : EventArgs - { - - public float X { get; } - public float Y { get; } - public float Z { get; } - - public AccelerometerEventArgs(float x, float y, float z) - { - X = x; - Y = y; - Z = z; - } - } -} diff --git a/AccelerometerFactory.cs b/AccelerometerFactory.cs deleted file mode 100644 index 4074e2a..0000000 --- a/AccelerometerFactory.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace WindowsPhoneSpeedyBlupi -{ - public class AccelerometerFactory - { - public static IAccelerometer Create() { return new AccelerometerDummyImpl(); } - } -} diff --git a/AccelerometerFailedException.cs b/AccelerometerFailedException.cs deleted file mode 100644 index 4dbf459..0000000 --- a/AccelerometerFailedException.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace WindowsPhoneSpeedyBlupi -{ - public class AccelerometerFailedException : Exception - { - } -} diff --git a/Def.cs b/Def.cs index d13bd25..51e011b 100644 --- a/Def.cs +++ b/Def.cs @@ -3,10 +3,22 @@ namespace WindowsPhoneSpeedyBlupi -{ +{ public static class Def { + public const bool DETAILED_DEBUGGING = false; + + public const Platform PLATFORM = Platform.Android; + + public enum Platform + { + Desktop, + Android, + iOS, + Web + } + public enum Phase { None, diff --git a/Game1.cs b/Game1.cs index 89aa5e1..034d7fd 100644 --- a/Game1.cs +++ b/Game1.cs @@ -979,6 +979,7 @@ namespace WindowsPhoneSpeedyBlupi this.graphics.ToggleFullScreen(); } public bool IsFullScreen() { return this.graphics.IsFullScreen; } + public GraphicsDeviceManager getGraphics() { return graphics; diff --git a/IAccelerometer.cs b/IAccelerometer.cs deleted file mode 100644 index f5cf42d..0000000 --- a/IAccelerometer.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace WindowsPhoneSpeedyBlupi -{ - public interface IAccelerometer - { - void Start(); - void Stop(); - event EventHandler CurrentValueChanged; - } -} diff --git a/InputPad.cs b/InputPad.cs index 85079c6..78a8fb1 100644 --- a/InputPad.cs +++ b/InputPad.cs @@ -287,44 +287,42 @@ namespace WindowsPhoneSpeedyBlupi click.Y = mouseState.Y; touchesOrClicks.Add(click); } - - + float screenWidth = game1.getGraphics().GraphicsDevice.Viewport.Width; float screenHeight = game1.getGraphics().GraphicsDevice.Viewport.Height; float screenRatio = screenWidth / screenHeight; - - //if (screenRatio < 1.3333333333333333 && false) + if (Def.PLATFORM == Platform.Android &&screenRatio < 1.3333333333333333) { for (int i = 0; i < touchesOrClicks.Count; i++) { - //if (touchOrClick.X == -1) continue; var touchOrClick = touchesOrClicks[i]; + if (touchOrClick.X == -1) continue; float originalX = touchOrClick.X; float originalY = touchOrClick.Y; - float widthHeightRatio = screenWidth / screenHeight; float heightRatio = 480 / screenHeight; float widthRatio = 640 / screenWidth; + if(Def.DETAILED_DEBUGGING) + { Debug.WriteLine("-----"); Debug.WriteLine("originalX=" + originalX); Debug.WriteLine("originalY=" + originalY); Debug.WriteLine("heightRatio=" + heightRatio); Debug.WriteLine("widthRatio=" + widthRatio); Debug.WriteLine("widthHeightRatio=" + widthHeightRatio); + } if (screenHeight> 480) { touchOrClick.X = (int)(originalX * heightRatio); touchOrClick.Y = (int)(originalY * heightRatio); touchesOrClicks[i] = touchOrClick; } - Debug.WriteLine("new X" + touchOrClick.X); - Debug.WriteLine("new Y" + touchOrClick.Y); - - + if(Def.DETAILED_DEBUGGING) Debug.WriteLine("new X" + touchOrClick.X); + if(Def.DETAILED_DEBUGGING) Debug.WriteLine("new Y" + touchOrClick.Y); } } diff --git a/Misc.cs b/Misc.cs index a1cad8c..80fd0c9 100644 --- a/Misc.cs +++ b/Misc.cs @@ -1,6 +1,7 @@ // WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439 // WindowsPhoneSpeedyBlupi.Misc using System; +using System.Diagnostics; using Microsoft.Xna.Framework; using WindowsPhoneSpeedyBlupi; using static WindowsPhoneSpeedyBlupi.Def; @@ -133,7 +134,7 @@ namespace WindowsPhoneSpeedyBlupi case 6: return KeyboardPress.Space; case 7: return KeyboardPress.Escape; case 8: return KeyboardPress.Pause; - default: return KeyboardPress.None; //throw new Exception("Unsupported number for KeyboardPress: " + i); + default: Debug.WriteLine("Unsupported number for KeyboardPress: " + i); return KeyboardPress.None; } } public static int keyboardPressToInt(KeyboardPress kp) diff --git a/Pixmap.cs b/Pixmap.cs index 2a96b4f..c11d449 100644 --- a/Pixmap.cs +++ b/Pixmap.cs @@ -66,7 +66,7 @@ namespace WindowsPhoneSpeedyBlupi TinyRect result = default(TinyRect); double screenWidth = graphics.GraphicsDevice.Viewport.Width; double screenHeight = graphics.GraphicsDevice.Viewport.Height; - if(screenHeight > 480) { + if(Def.PLATFORM == Def.Platform.Android && screenHeight > 480) { screenWidth = screenHeight * (640f / 480f); } if (screenWidth != 0.0 && screenHeight != 0.0) @@ -248,12 +248,10 @@ namespace WindowsPhoneSpeedyBlupi { double screenWidth = graphics.GraphicsDevice.Viewport.Width; double screenHeight = graphics.GraphicsDevice.Viewport.Height; - if (screenHeight > 480) + if (Def.PLATFORM == Def.Platform.Android && screenHeight > 480) { screenWidth = screenHeight * (640f / 480f); } - Debug.WriteLine("graphics.GraphicsDevice.Viewport.Width=" + graphics.GraphicsDevice.Viewport.Width); - Debug.WriteLine("graphics.GraphicsDevice.Viewport.Height=" + graphics.GraphicsDevice.Viewport.Height); double val = screenWidth / 640.0; double val2 = screenHeight / 480.0; zoom = Math.Min(val, val2); @@ -281,7 +279,7 @@ namespace WindowsPhoneSpeedyBlupi { double screenWidth = graphics.GraphicsDevice.Viewport.Width; double screenHeight = graphics.GraphicsDevice.Viewport.Height; - if (screenHeight > 480) + if (Def.PLATFORM == Def.Platform.Android && screenHeight > 480) { screenWidth = screenHeight * (640f / 480f); }