WPF:如何实现操纵杆作为替代输入设备(C#)
我正在为幼儿开发一款简单的点击游戏。因为有些孩子有身体限制,我想让他们有可能使用操纵杆作为替代输入设备。
谁能给我一些关于如何实现这个的建议、技巧或一些示例 C#(甚至 VB.net)代码?
我宁愿不使用 DirectX 中的某些东西,因为我认为这对于此类游戏来说太过分了。
谢谢!
更新:
我阅读了给定链接上的大部分信息。我尝试将 DirectInput 引入 VS 2010,但收到有关找不到引用的错误。我在网上搜索了解决方案,但在很多地方我都读到 DirectX 已过时,我应该使用 XNA。但我找到的有关 XNA 的所有信息都是有关 Windows Phone 和 XBox 的。在 Microsoft XNA 开发人员中心,他们说如果您想为 Windows 进行开发,则必须使用 DirectX,这让我回到了原点!
有人可以帮助我回到正轨吗?我只想在 Windows WPF 应用程序中使用操纵杆,并且我使用的是 VS 2010 C#。谢谢。
I'm working on a simple point-and-click game for young children. Because some children have a physical limitation I would like to give them the possibility to use a joystick as an alternative input device.
Can anyone give me some advice, tips or some sample C# (or even VB.net) code on how to implement this?
I would rather not use something from DirectX as I think this would be overkill for this type of game.
Thanks!
Update:
I read most of the information on the given links. I tried to get DirectInput into VS 2010, but I get an error about a reference that cannot be found. I searched the net for a solution, but on many places I read that DirectX is obsolete and I should use XNA. But all information I find about XNA is about Windows Phone and XBox. On the Microsoft XNA Developer Center they say that if you want to develop for Windows you have to use DirectX and that brings me back to square one!
Can somebody help me back on track? I only want to use a joystick in my Windows WPF application and I'm using VS 2010 C#. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 DirectInput 库,您可以从操纵杆读取输入。您不必使用 DirectX 来渲染输出,您只需使用输入即可。
一些方便的链接:
Using the DirectInput library, you can read input from a Joystick. You do not have to use DirectX to render the output, you are just using the input.
Some handy links:
我对此不太了解,但在我将这些设备连接到 PC 的少数情况下,设备的驱动程序允许您将按键映射到设备上的输入。
因此,您只需允许您的应用程序接受键盘输入来移动光标等,并将相关按键映射到操纵杆上的方向等。
I don't know a bunch about this but in the few instances where I have attached these devices to a PC the driver for the device allows you to map keys to the inputs on the device.
So you would just allow your app to take keyboard inputs to move the cursor etc. and map the relevant keys to the directions etc. on the joystick.