Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF: How to implement joystick as alternative input device (C#)

Tags:

c#

wpf

joystick

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.

like image 548
Jackerd Avatar asked Oct 26 '22 02:10

Jackerd


1 Answers

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:

  • Coding 4 Fun
  • From MSDN
like image 67
GvS Avatar answered Nov 15 '22 06:11

GvS