本文主要是介绍c# DirectX DirectInput 游戏手柄 游戏摇杆 编程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
采用微软DirectX的DirectInput编程,控制游戏手柄,游戏摇杆
项目想要用游戏摇杆控制无人车,用莱仕达的雷霆PRO做实验。
源码用VS2015写的,winform程序。
摇杆实物图:
软件界面:
部分代码:
查找设备
public string FindJoysticks(){systemJoysticks = null;try{// Find all the GameControl devices that are attached.DeviceList gameControllerList = Manager.GetDevices(DeviceClass.GameControl, EnumDevicesFlags.AttachedOnly);// check that we have at least one device.if (gameControllerList.Count > 0){foreach (DeviceInstance deviceInstance in gameControllerList){// create a device from this controller so we can retrieve info.joystickDevice =
这篇关于c# DirectX DirectInput 游戏手柄 游戏摇杆 编程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!