Added support for the keyboard III

This commit is contained in:
Your Name 2024-11-24 01:54:59 +01:00
parent 8862039e55
commit 4d3bfd1e91

View File

@ -268,7 +268,8 @@ namespace WindowsPhoneSpeedyBlupi
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;
@ -289,7 +290,7 @@ namespace WindowsPhoneSpeedyBlupi
KeyboardState newState = Keyboard.GetState();
{
if(newState.IsKeyDown(Keys.LeftControl)) touchesOrClicks.Add(createTinyPoint(-1, Misc.keyboardPressToInt(KeyboardPress.LeftControl)));
if (newState.IsKeyDown(Keys.LeftControl)) touchesOrClicks.Add(createTinyPoint(-1, Misc.keyboardPressToInt(KeyboardPress.LeftControl)));
if (newState.IsKeyDown(Keys.Up)) touchesOrClicks.Add(createTinyPoint(-1, Misc.keyboardPressToInt(KeyboardPress.Up)));
if (newState.IsKeyDown(Keys.Right)) touchesOrClicks.Add(createTinyPoint(-1, Misc.keyboardPressToInt(KeyboardPress.Right)));
if (newState.IsKeyDown(Keys.Down)) touchesOrClicks.Add(createTinyPoint(-1, Misc.keyboardPressToInt(KeyboardPress.Down)));
@ -315,13 +316,13 @@ namespace WindowsPhoneSpeedyBlupi
keyPressedRight = keyboardPress == KeyboardPress.Right;
{
TinyPoint tinyPoint2 = keyboardPressed ? createTinyPoint(1,1) : touchOrClick;
TinyPoint tinyPoint2 = keyboardPressed ? createTinyPoint(1, 1) : touchOrClick;
if (!accelStarted && Misc.IsInside(GetPadBounds(PadCenter, padSize), tinyPoint2))
{
padPressed = true;
padTouchPos = tinyPoint2;
}
if(keyboardPress == KeyboardPress.Up || keyboardPress == KeyboardPress.Right || keyboardPress == KeyboardPress.Down || keyboardPress == KeyboardPress.Left)
if (keyboardPress == KeyboardPress.Up || keyboardPress == KeyboardPress.Right || keyboardPress == KeyboardPress.Down || keyboardPress == KeyboardPress.Left)
{
padPressed = true;
}
@ -332,7 +333,7 @@ namespace WindowsPhoneSpeedyBlupi
{
pressedGlyphs.Add(buttonGlygh2);
}
if(keyboardPressed)
if (keyboardPressed)
{
switch (keyboardPress)
{
@ -424,10 +425,31 @@ namespace WindowsPhoneSpeedyBlupi
Debug.WriteLine("padTouchPos.X=" + padTouchPos.X);
Debug.WriteLine("padTouchPos.Y=" + padTouchPos.Y);
{
if (keyPressedUp) { padTouchPos.X = PadCenter.X; padTouchPos.Y = PadCenter.Y - 30; }
if (keyPressedDown) { padTouchPos.X = PadCenter.X; padTouchPos.Y = PadCenter.Y + 30; }
if (keyPressedLeft) { padTouchPos.X = PadCenter.X - 30; padTouchPos.Y = PadCenter.Y; }
if (keyPressedRight) { padTouchPos.X = PadCenter.X + 30; padTouchPos.Y = PadCenter.Y;}
if (keyPressedUp)
{
padTouchPos.Y = PadCenter.Y - 30;
padTouchPos.X = PadCenter.X;
if (keyPressedLeft) padTouchPos.X = PadCenter.X - 30;
if (keyPressedRight) padTouchPos.X = PadCenter.X + 30;
}
if (keyPressedDown) {
padTouchPos.Y = PadCenter.Y + 30;
padTouchPos.X = PadCenter.X;
if (keyPressedLeft) padTouchPos.X = PadCenter.X - 30;
if (keyPressedRight) padTouchPos.X = PadCenter.X + 30;
}
if (keyPressedLeft) {
padTouchPos.X = PadCenter.X - 30;
padTouchPos.Y = PadCenter.Y;
if (keyPressedUp) padTouchPos.Y = PadCenter.Y - 30;
if (keyPressedDown) padTouchPos.Y = PadCenter.Y + 30;
}
if (keyPressedRight) {
padTouchPos.X = PadCenter.X + 30;
padTouchPos.Y = PadCenter.Y;
if (keyPressedUp) padTouchPos.Y = PadCenter.Y - 30;
if (keyPressedDown) padTouchPos.Y = PadCenter.Y + 30;
}
}
double horizontalPosition = padTouchPos.X - PadCenter.X;
double verticalPosition = padTouchPos.Y - PadCenter.Y;