summaryrefslogtreecommitdiff
path: root/WindowsPhone
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2012-05-02 22:19:34 +0000
committerIan C <ianc@noddybox.co.uk>2012-05-02 22:19:34 +0000
commita4cb1430b5286f2dd8a1fd1dc15d7c12fd0382fd (patch)
tree7fd84da31dcacf82a22ca4514ac8e37b428f97aa /WindowsPhone
parent78adb7aa6ccd4bfe8924d08ac655b325f32d7562 (diff)
Improved event handling and added event to propagate touches the keyboard is not interested in.
Diffstat (limited to 'WindowsPhone')
-rw-r--r--WindowsPhone/KeyboardTest.suobin44544 -> 48128 bytes
-rw-r--r--WindowsPhone/KeyboardTest/KeyboardTest/Game1.cs19
2 files changed, 15 insertions, 4 deletions
diff --git a/WindowsPhone/KeyboardTest.suo b/WindowsPhone/KeyboardTest.suo
index 585204c..3e2bd4d 100644
--- a/WindowsPhone/KeyboardTest.suo
+++ b/WindowsPhone/KeyboardTest.suo
Binary files differ
diff --git a/WindowsPhone/KeyboardTest/KeyboardTest/Game1.cs b/WindowsPhone/KeyboardTest/KeyboardTest/Game1.cs
index 95e4a68..882ef72 100644
--- a/WindowsPhone/KeyboardTest/KeyboardTest/Game1.cs
+++ b/WindowsPhone/KeyboardTest/KeyboardTest/Game1.cs
@@ -94,6 +94,7 @@ namespace KeyboardTest
keyboard = new KeyboardDriver<KeySymbol>(graphics.GraphicsDevice, keyboardImage, Vector2.Zero, def);
keyboard.KeyEvent += KeyPress;
+ keyboard.TouchEvent += Touch;
}
/// <summary>
@@ -131,21 +132,31 @@ namespace KeyboardTest
foreach(string s in output)
{
- spriteBatch.DrawString(font, s, pos, Color.White);
- pos.Y += 30;
+ spriteBatch.DrawString(font, s, pos, Color.White, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 1f);
+ pos.Y += 15;
}
spriteBatch.End();
}
- private void KeyPress(object sender, KeyboardDriver<KeySymbol>.KeyPress e)
+ private void KeyPress(object sender, KeyboardDriver<KeySymbol>.KeyPressEventArgs e)
{
- if (output.Count > 15)
+ if (output.Count > 35)
{
output.RemoveAt(0);
}
output.Add(String.Format("{0} - {1}", e.Key.ToString(), e.Pressed.ToString()));
}
+
+ private void Touch(object sender, KeyboardDriver<KeySymbol>.TouchLocationEventArgs e)
+ {
+ if (output.Count > 35)
+ {
+ output.RemoveAt(0);
+ }
+
+ output.Add(String.Format("{0} - {1} {2}", e.Location.Id, e.Location.Position, e.Location.State));
+ }
}
}