From aaa894f9fb55b2acda5450a6d73669cb1f9dc9c9 Mon Sep 17 00:00:00 2001 From: Glatzemann Date: Tue, 17 Jan 2012 05:28:26 +0000 Subject: [PATCH] fixed issue #535 (XInput sample not working) --- Samples/Xinput/Program.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Samples/Xinput/Program.cs b/Samples/Xinput/Program.cs index b86da6ce..5e3ec2cd 100644 --- a/Samples/Xinput/Program.cs +++ b/Samples/Xinput/Program.cs @@ -66,6 +66,7 @@ namespace Xinput controller[2] = new Controller(UserIndex.Three); controller[3] = new Controller(UserIndex.Four); controller[4] = new Controller(UserIndex.Any); + foreach (Controller item in controller) { Console.WriteLine(item.IsConnected); @@ -74,16 +75,16 @@ namespace Xinput Console.WriteLine(item.GetState().Gamepad.ToString()); } } - var test = controller[0].GetCapabilities(DeviceQueryType.Gamepad); - for (int i = 0; i <16; i++) + + if (controller[0].IsConnected) { - Console.WriteLine( "{0,3} - {1}",i, ( (GamepadButtonFlags)i ).ToString( ) ); + var test = controller[0].GetCapabilities(DeviceQueryType.Gamepad); + for (int i = 0; i < 16; i++) + { + Console.WriteLine("{0,3} - {1}", i, ((GamepadButtonFlags)i).ToString()); + } } - int a = 4; - int b = 15; - int c = a & b; - Console.WriteLine(c); - //var state = controller[0].GetState(); + Console.Read(); } }