Joystick support for Mac OS X

Alexander Lazarević Alexander at Lazarevic.de
Wed Nov 24 10:54:38 UTC 2004


Hi Dominique!

I've written a replacement for the joystick plugin for windows and maybe 
you are interested in collaborating on a unified one.

The rewritten joystick plugin features are:
* deals simultaneously with upto 10 input devices
* supports upto 32 buttons per device
* supports upto 6 axis per device (X,Y, Z, R, U, V)
* supports D-Pads (continuous or discrete 4-/8-way point of view 0°-360°)
* is event driven (because of this and the above features it is not 
compatible with the old joystick plugin)

STiCK is the software on the image side. Among other things it provides 
joystick support for morphic. With this it is (fairly) easy to make 
morphs react on joystick events.

1)  register your morph to receive joystick events by implementing any 
of the following methods to return true
  handlesJoystickButtons: evt
  handlesJoystickAxis: evt
  handlesJoystickPOV: evt

2) process any joystick events inside these methods
  joystickAxis: evt
  joystickButtonDown: evt
  joystickButtonUp: evt
  joystickPOVcentered: evt
  joystickPOVcentered: evt
  joystivkPOVpressed: evt

evt may be any of the new morphic events JoystickButtonEvent, 
JoystickAxisEvent and JoystickPOVEvent. They implement numerous methods 
to interpret themselfs like xAxis, yAxisUnit, zrAnyChanged or 
singleButtonPressed: number, anyButtonsReleased: collection.

STiCK also provides pseudo devices like PseudoMouse and PseudoKeyboard. 
The PseudoMouse lets you use a joystick as a mouse replacement. I used 
the PseudoKeyboard to implement TeXXen, which makes it possible to enter 
text with a Saitek P2500 Gamepad. Here [1] is a low quality video of a 
short demo.

Missing features:
  * mapping (switch axis or buttons)
  * calibration (most newer devices have auto calibration though)
  * force feedback

I will try to clean up the code, package it and upload it to some place 
"in the near future".

Alex

[1] http://www.lazarevic.de/maic/GPText.wmv





More information about the Squeak-dev mailing list