[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Pnet-developers] implementing joystick support
From: |
Rhys Weatherley |
Subject: |
Re: [Pnet-developers] implementing joystick support |
Date: |
Thu, 15 Jan 2004 06:30:41 +1000 |
User-agent: |
KMail/1.4.3 |
On Thursday 15 January 2004 01:54 am, Tobias Bengtsson wrote:
> I've written c-code that get events from the Linux joystick
> driver for you guys to look at. I'm a C# beginner but with some
> guidelines and help I could probably fit it in pnet.
I suggest that you write a small C library that implements the operations that
you need, and then wrap that with PInvoke. Or use PInvoke to import the libc
open/read/ioctl routines and call them directly like you would in C code. I
personally would use the former, because it will be easier to port to new
platforms with different joystick drivers.
It isn't really feasible to provide generic access to Posix via C#. The ioctl
system call, in particular, varies a lot between systems and OS versions, and
wrapping it in a way that would make it useful is just not possible. But if
you wrap the ugly bits with C first, you can avoid the problem.
Cheers,
Rhys.