gpt4 book ai didi

c++ - 带 C++ 和 DirectInput 的 USB 操纵杆

转载 作者:搜寻专家 更新时间:2023-10-31 01:15:46 40 4
gpt4 key购买 nike

我一直在尝试从 USB 操纵杆读取数据(x/y 轴、按下的按钮等),而且我听说过 DirectInput。一直在寻找几个小时来找到一个像样的例子或演练但收效甚微。如果有人可以分享一个简单的教程,或者指导我到正确的地方,我会感激你。谢谢

编辑:试图在Windows平台上实现这个目标

最佳答案

DirectX SDK、源代码和编译的二进制文件中有一些 DirectInput 示例。包括 Joystick 示例。旧版本的 SDK(寻找“DirectX 9.0 SDK”,大约在 2004-2005 年)有更多的样本,多达十几个!

Joystick Sample


Description The Joystick sample program obtains and displays joystick data.

Path Source: (SDK root )\Samples\C++\DirectInput\Joystick

Executable: (SDK root )\Samples\C++\DirectInput\Bin\Joystick.exe

User's Guide Observe how the displayed data changes when you move and twist the stick, rotate the throttle wheel, and press buttons in various combinations.

Programming Notes The application polls the joystick for immediate data in response to a timer set inside the dialog procedure.

关于c++ - 带 C++ 和 DirectInput 的 USB 操纵杆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9742611/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com