2012-08-09 09:45:04 +00:00
|
|
|
#region Using Statements
|
2011-10-31 05:36:24 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using SharpDX.XInput;
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
// This file is part of the ANX.Framework created by the
|
|
|
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
|
|
|
// For details see: http://anxframework.codeplex.com/license
|
2011-10-31 05:36:24 +00:00
|
|
|
|
|
|
|
namespace Xinput
|
|
|
|
{
|
|
|
|
class Program
|
|
|
|
{
|
|
|
|
static void Main(string[] args)
|
|
|
|
{
|
|
|
|
Controller[] controller = new Controller[5];
|
|
|
|
controller[0] = new Controller(UserIndex.One);
|
|
|
|
controller[1] = new Controller(UserIndex.Two);
|
|
|
|
controller[2] = new Controller(UserIndex.Three);
|
|
|
|
controller[3] = new Controller(UserIndex.Four);
|
|
|
|
controller[4] = new Controller(UserIndex.Any);
|
2012-01-17 05:28:26 +00:00
|
|
|
|
2011-10-31 05:36:24 +00:00
|
|
|
foreach (Controller item in controller)
|
|
|
|
{
|
|
|
|
Console.WriteLine(item.IsConnected);
|
|
|
|
if (item.IsConnected)
|
|
|
|
{
|
|
|
|
Console.WriteLine(item.GetState().Gamepad.ToString());
|
|
|
|
}
|
|
|
|
}
|
2012-01-17 05:28:26 +00:00
|
|
|
|
|
|
|
if (controller[0].IsConnected)
|
2011-10-31 05:36:24 +00:00
|
|
|
{
|
2012-01-17 05:28:26 +00:00
|
|
|
var test = controller[0].GetCapabilities(DeviceQueryType.Gamepad);
|
|
|
|
for (int i = 0; i < 16; i++)
|
|
|
|
{
|
|
|
|
Console.WriteLine("{0,3} - {1}", i, ((GamepadButtonFlags)i).ToString());
|
|
|
|
}
|
2011-10-31 05:36:24 +00:00
|
|
|
}
|
2012-01-17 05:28:26 +00:00
|
|
|
|
2011-10-31 05:36:24 +00:00
|
|
|
Console.Read();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|