Page 1 of 1

Using a Joystick as a mouse

Posted: Sun Apr 26, 2009 12:29 am
by Rookie
I am trying to code a way to use the joystick as a mouse. I found a way to do it on purearea, but I can only use the demo and want to use it in linux. Is there a demo friendly way of doing this. I have tried, but for the life of me can't figure it out. Also something that can work for windows and linux.

Thanks for the help.

Posted: Sun Apr 26, 2009 12:39 am
by Mistrel
This is possible on Windows using the DirectInput library. I don't know how it would be done on Linux.

According to this article these functions are also available through the Windows PSDK. These commands do appear to be included with PureBasic's wrapper for the WINMM library:

http://support.microsoft.com/kb/133065

I believe this is a complete list of the functions exposed by the Win32 API. You'll have to use DirectInput for force-feedback:

Code: Select all

joyGetDevCaps
joyGetNumDevs
joyGetPos
joyGetPosEx
joyGetThreshold
joyReleaseCapture
joySetCapture
joySetThreshold

Posted: Sun Apr 26, 2009 5:02 am
by Hroudtwolf
Hi,

Don't reinvent the wheel.
Try this...
http://www.hroudtwolf.de/components/com ... /jouse.zip

Regards

Wolf

Posted: Sun Apr 26, 2009 5:17 am
by Mistrel
He may want something custom which would require source code.

Posted: Sun Apr 26, 2009 6:46 pm
by Rookie
Lets see if I can explain it a bit better.
What I need is a way to change the position of the mouse cursor on the desktop.
Also a way to simulate a mouse click as well.
I can't use the Windows API for 2 reasons. I have the demo and linux.

Posted: Sun Apr 26, 2009 6:51 pm
by Kaeru Gaman
it is not possible to move the mousecursor on the desktop with native PB-commands.

Posted: Sun Apr 26, 2009 6:57 pm
by Rookie
Well that sucks. There goes my little project.