mirror of
https://github.com/openeggbert/mobile-eggbert-monogame-desktop.git
synced 2025-03-26 16:09:24 +01:00
Added the mouse support
This commit is contained in:
parent
40753c86be
commit
04e38b079b
43
InputPad.cs
43
InputPad.cs
@ -3,6 +3,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
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;
|
||||||
@ -39,7 +41,7 @@ namespace WindowsPhoneSpeedyBlupi
|
|||||||
|
|
||||||
private Def.ButtonGlygh buttonPressed;
|
private Def.ButtonGlygh buttonPressed;
|
||||||
|
|
||||||
private int totalTouch;
|
private int touchCount;
|
||||||
|
|
||||||
private bool accelStarted;
|
private bool accelStarted;
|
||||||
|
|
||||||
@ -63,7 +65,7 @@ namespace WindowsPhoneSpeedyBlupi
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return totalTouch;
|
return touchCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,16 +256,37 @@ namespace WindowsPhoneSpeedyBlupi
|
|||||||
int num3 = 0;
|
int num3 = 0;
|
||||||
padPressed = false;
|
padPressed = false;
|
||||||
Def.ButtonGlygh buttonGlygh = Def.ButtonGlygh.None;
|
Def.ButtonGlygh buttonGlygh = Def.ButtonGlygh.None;
|
||||||
TouchCollection state = TouchPanel.GetState();
|
TouchCollection touches = TouchPanel.GetState();
|
||||||
totalTouch = state.Count;
|
touchCount = touches.Count;
|
||||||
foreach (TouchLocation item in state)
|
List<TinyPoint> touchesOrClicks = new List<TinyPoint>();
|
||||||
|
foreach (TouchLocation item in touches)
|
||||||
{
|
{
|
||||||
if (item.State == TouchLocationState.Pressed || item.State == TouchLocationState.Moved)
|
if (item.State == TouchLocationState.Pressed || item.State == TouchLocationState.Moved) {
|
||||||
|
TinyPoint tinyPoint = default(TinyPoint);
|
||||||
|
tinyPoint.X = (int)item.Position.X;
|
||||||
|
tinyPoint.Y = (int)item.Position.Y;
|
||||||
|
touchesOrClicks.Add(tinyPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MouseState mouseState = Mouse.GetState();
|
||||||
|
if (mouseState.LeftButton == ButtonState.Pressed)
|
||||||
|
{
|
||||||
|
touchCount++;
|
||||||
|
TinyPoint click = new TinyPoint();
|
||||||
|
click.X = mouseState.X;
|
||||||
|
click.Y = mouseState.Y;
|
||||||
|
touchesOrClicks.Add(click);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach (TinyPoint touchOrClick in touchesOrClicks)
|
||||||
|
{
|
||||||
|
|
||||||
{
|
{
|
||||||
TinyPoint tinyPoint = default(TinyPoint);
|
TinyPoint tinyPoint2 = touchOrClick;
|
||||||
tinyPoint.X = (int)item.Position.X;
|
|
||||||
tinyPoint.Y = (int)item.Position.Y;
|
|
||||||
TinyPoint tinyPoint2 = tinyPoint;
|
|
||||||
if (!accelStarted && Misc.IsInside(GetPadBounds(PadCenter, padSize), tinyPoint2))
|
if (!accelStarted && Misc.IsInside(GetPadBounds(PadCenter, padSize), tinyPoint2))
|
||||||
{
|
{
|
||||||
padPressed = true;
|
padPressed = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user