Trying to get Joystick input with DirectX DirectInput but the program seems to hang/freeze
without any errors on Manager.GetDevices().
Here is the simple code:
// C#
using Microsoft.DirectX.DirectInput;
namespace Input
{
class Controller
{
static void InitJoystick()
{
foreach (DeviceInstance di in Manager.GetDevices( DeviceClass.GameControl, EnumDevicesFlags.AttachedOnly))
{
Console.WriteLine(di.InstanceGuid);
}
}
static void Main(string[] args)
{
InitJoystick();
}
}
}
Does anyone know what im doing wrong?
-
1What version of DirectX and VS are you using? Did you try running your app with admin rights? Also, check if any errors have been logged on the Event Viewer.Nick Papadiochos– Nick Papadiochos2022年05月19日 22:12:37 +00:00Commented May 19, 2022 at 22:12
-
Latest DirectX Sdk (June 210) and 2022 VS. There are also no errors in the Event Viewer. I now just used SharpDX which works fine but it sucks to use a third party library.erwfvsdcs– erwfvsdcs2022年05月20日 09:00:50 +00:00Commented May 20, 2022 at 9:00
lang-cs