Both the Android and Desktop versions were synchronized
This commit is contained in:
parent
e640eaee2f
commit
76115df37d
2
.gitignore
vendored
2
.gitignore
vendored
@ -241,3 +241,5 @@ ModelManifest.xml
|
|||||||
# FAKE - F# Make
|
# FAKE - F# Make
|
||||||
.fake/
|
.fake/
|
||||||
rv.keystore
|
rv.keystore
|
||||||
|
|
||||||
|
*.bak
|
||||||
|
@ -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<AccelerometerEventArgs> CurrentValueChanged;
|
|
||||||
|
|
||||||
private Accelerometer accelerometer = new Accelerometer();
|
|
||||||
public void Start()
|
|
||||||
{
|
|
||||||
accelerometer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Stop()
|
|
||||||
{
|
|
||||||
accelerometer.Stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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<AccelerometerEventArgs> CurrentValueChanged;
|
|
||||||
|
|
||||||
public void Start()
|
|
||||||
{
|
|
||||||
//throw new AccelerometerFailedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Stop()
|
|
||||||
{
|
|
||||||
//throw new AccelerometerFailedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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(); }
|
|
||||||
}
|
|
||||||
}
|
|
@ -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
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
14
Def.cs
14
Def.cs
@ -3,10 +3,22 @@
|
|||||||
|
|
||||||
|
|
||||||
namespace WindowsPhoneSpeedyBlupi
|
namespace WindowsPhoneSpeedyBlupi
|
||||||
{
|
{
|
||||||
|
|
||||||
public static class Def
|
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
|
public enum Phase
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
|
1
Game1.cs
1
Game1.cs
@ -979,6 +979,7 @@ namespace WindowsPhoneSpeedyBlupi
|
|||||||
this.graphics.ToggleFullScreen();
|
this.graphics.ToggleFullScreen();
|
||||||
}
|
}
|
||||||
public bool IsFullScreen() { return this.graphics.IsFullScreen; }
|
public bool IsFullScreen() { return this.graphics.IsFullScreen; }
|
||||||
|
|
||||||
public GraphicsDeviceManager getGraphics()
|
public GraphicsDeviceManager getGraphics()
|
||||||
{
|
{
|
||||||
return graphics;
|
return graphics;
|
||||||
|
@ -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<AccelerometerEventArgs> CurrentValueChanged;
|
|
||||||
}
|
|
||||||
}
|
|
18
InputPad.cs
18
InputPad.cs
@ -287,44 +287,42 @@ namespace WindowsPhoneSpeedyBlupi
|
|||||||
click.Y = mouseState.Y;
|
click.Y = mouseState.Y;
|
||||||
touchesOrClicks.Add(click);
|
touchesOrClicks.Add(click);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float screenWidth = game1.getGraphics().GraphicsDevice.Viewport.Width;
|
float screenWidth = game1.getGraphics().GraphicsDevice.Viewport.Width;
|
||||||
float screenHeight = game1.getGraphics().GraphicsDevice.Viewport.Height;
|
float screenHeight = game1.getGraphics().GraphicsDevice.Viewport.Height;
|
||||||
float screenRatio = screenWidth / screenHeight;
|
float screenRatio = screenWidth / screenHeight;
|
||||||
|
|
||||||
|
if (Def.PLATFORM == Platform.Android &&screenRatio < 1.3333333333333333)
|
||||||
//if (screenRatio < 1.3333333333333333 && false)
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < touchesOrClicks.Count; i++)
|
for (int i = 0; i < touchesOrClicks.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
//if (touchOrClick.X == -1) continue;
|
|
||||||
var touchOrClick = touchesOrClicks[i];
|
var touchOrClick = touchesOrClicks[i];
|
||||||
|
if (touchOrClick.X == -1) continue;
|
||||||
|
|
||||||
float originalX = touchOrClick.X;
|
float originalX = touchOrClick.X;
|
||||||
float originalY = touchOrClick.Y;
|
float originalY = touchOrClick.Y;
|
||||||
|
|
||||||
|
|
||||||
float widthHeightRatio = screenWidth / screenHeight;
|
float widthHeightRatio = screenWidth / screenHeight;
|
||||||
float heightRatio = 480 / screenHeight;
|
float heightRatio = 480 / screenHeight;
|
||||||
float widthRatio = 640 / screenWidth;
|
float widthRatio = 640 / screenWidth;
|
||||||
|
if(Def.DETAILED_DEBUGGING)
|
||||||
|
{
|
||||||
Debug.WriteLine("-----");
|
Debug.WriteLine("-----");
|
||||||
Debug.WriteLine("originalX=" + originalX);
|
Debug.WriteLine("originalX=" + originalX);
|
||||||
Debug.WriteLine("originalY=" + originalY);
|
Debug.WriteLine("originalY=" + originalY);
|
||||||
Debug.WriteLine("heightRatio=" + heightRatio);
|
Debug.WriteLine("heightRatio=" + heightRatio);
|
||||||
Debug.WriteLine("widthRatio=" + widthRatio);
|
Debug.WriteLine("widthRatio=" + widthRatio);
|
||||||
Debug.WriteLine("widthHeightRatio=" + widthHeightRatio);
|
Debug.WriteLine("widthHeightRatio=" + widthHeightRatio);
|
||||||
|
}
|
||||||
if (screenHeight> 480) {
|
if (screenHeight> 480) {
|
||||||
touchOrClick.X = (int)(originalX * heightRatio);
|
touchOrClick.X = (int)(originalX * heightRatio);
|
||||||
touchOrClick.Y = (int)(originalY * heightRatio);
|
touchOrClick.Y = (int)(originalY * heightRatio);
|
||||||
touchesOrClicks[i] = touchOrClick;
|
touchesOrClicks[i] = touchOrClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.WriteLine("new X" + touchOrClick.X);
|
if(Def.DETAILED_DEBUGGING) Debug.WriteLine("new X" + touchOrClick.X);
|
||||||
Debug.WriteLine("new Y" + touchOrClick.Y);
|
if(Def.DETAILED_DEBUGGING) Debug.WriteLine("new Y" + touchOrClick.Y);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
Misc.cs
3
Misc.cs
@ -1,6 +1,7 @@
|
|||||||
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
|
// WindowsPhoneSpeedyBlupi, Version=1.0.0.5, Culture=neutral, PublicKeyToken=6db12cd62dbec439
|
||||||
// WindowsPhoneSpeedyBlupi.Misc
|
// WindowsPhoneSpeedyBlupi.Misc
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using WindowsPhoneSpeedyBlupi;
|
using WindowsPhoneSpeedyBlupi;
|
||||||
using static WindowsPhoneSpeedyBlupi.Def;
|
using static WindowsPhoneSpeedyBlupi.Def;
|
||||||
@ -133,7 +134,7 @@ namespace WindowsPhoneSpeedyBlupi
|
|||||||
case 6: return KeyboardPress.Space;
|
case 6: return KeyboardPress.Space;
|
||||||
case 7: return KeyboardPress.Escape;
|
case 7: return KeyboardPress.Escape;
|
||||||
case 8: return KeyboardPress.Pause;
|
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)
|
public static int keyboardPressToInt(KeyboardPress kp)
|
||||||
|
@ -66,7 +66,7 @@ namespace WindowsPhoneSpeedyBlupi
|
|||||||
TinyRect result = default(TinyRect);
|
TinyRect result = default(TinyRect);
|
||||||
double screenWidth = graphics.GraphicsDevice.Viewport.Width;
|
double screenWidth = graphics.GraphicsDevice.Viewport.Width;
|
||||||
double screenHeight = graphics.GraphicsDevice.Viewport.Height;
|
double screenHeight = graphics.GraphicsDevice.Viewport.Height;
|
||||||
if(screenHeight > 480) {
|
if(Def.PLATFORM == Def.Platform.Android && screenHeight > 480) {
|
||||||
screenWidth = screenHeight * (640f / 480f);
|
screenWidth = screenHeight * (640f / 480f);
|
||||||
}
|
}
|
||||||
if (screenWidth != 0.0 && screenHeight != 0.0)
|
if (screenWidth != 0.0 && screenHeight != 0.0)
|
||||||
@ -248,12 +248,10 @@ namespace WindowsPhoneSpeedyBlupi
|
|||||||
{
|
{
|
||||||
double screenWidth = graphics.GraphicsDevice.Viewport.Width;
|
double screenWidth = graphics.GraphicsDevice.Viewport.Width;
|
||||||
double screenHeight = graphics.GraphicsDevice.Viewport.Height;
|
double screenHeight = graphics.GraphicsDevice.Viewport.Height;
|
||||||
if (screenHeight > 480)
|
if (Def.PLATFORM == Def.Platform.Android && screenHeight > 480)
|
||||||
{
|
{
|
||||||
screenWidth = screenHeight * (640f / 480f);
|
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 val = screenWidth / 640.0;
|
||||||
double val2 = screenHeight / 480.0;
|
double val2 = screenHeight / 480.0;
|
||||||
zoom = Math.Min(val, val2);
|
zoom = Math.Min(val, val2);
|
||||||
@ -281,7 +279,7 @@ namespace WindowsPhoneSpeedyBlupi
|
|||||||
{
|
{
|
||||||
double screenWidth = graphics.GraphicsDevice.Viewport.Width;
|
double screenWidth = graphics.GraphicsDevice.Viewport.Width;
|
||||||
double screenHeight = graphics.GraphicsDevice.Viewport.Height;
|
double screenHeight = graphics.GraphicsDevice.Viewport.Height;
|
||||||
if (screenHeight > 480)
|
if (Def.PLATFORM == Def.Platform.Android && screenHeight > 480)
|
||||||
{
|
{
|
||||||
screenWidth = screenHeight * (640f / 480f);
|
screenWidth = screenHeight * (640f / 480f);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user