我将 DirectInput 与 XNA 一起使用,但是由于某些奇怪的原因,当我实现以下代码时,我的游戏将无法启动:
DeviceList gameControllerList = Manager.GetDevices(DeviceClass.GameControl, EnumDevicesFlags.AttachedOnly);
这真的打破了我的游戏,评论这条线虽然留下了它却打破了它。我完全不知道为什么。我已经Microsoft.DirectX.DirectInput
参考了一切。我什至开始了一个全新的项目,刚刚进入那条线,但在游戏启动时没有运气。
这实际上是我的完整代码,我只是Input.InitializeController()
从Game1()
.
using System;
using Microsoft.DirectX.DirectInput;
namespace InputTesting{
class Input{
public void InitializeController(){
DeviceList gameControllerList = Manager.GetDevices(DeviceClass.GameControl, EnumDevicesFlags.AttachedOnly);
}
}
}
有谁知道这是怎么回事,我完全被难住了。
谢谢!