From imattsson at common-lisp.net Wed Dec 27 16:29:59 2006
From: imattsson at common-lisp.net (Ingvar Mattsson)
Date: Wed, 27 Dec 2006 16:29:59 +0000
Subject: [gamelib-cvs] stick.html
Message-ID: <20061227162959.75EC425002@common-lisp.net>
Update of /project/gamelib/cvsroot/source/doc
In directory clnet:/tmp/cvs-serv968/doc
Added Files:
stick.html
Log Message:
IM
Initial check-in
--- NEW FILE: stick.html ---
Gamelib - games-3d library
Gamelib
The joystick library
Introduction
Having the use of a joystick enhances the sensation of presence in a
game. Under linux, the available joystick API is based around periodic
reading of events from a device driver file (usually /dev/jsX
or /dev/input/jsX).
Gamelib now offers an interface to handle joysticks on the linux
platform (code for joystick handling on other platforms is
welcome). The joystick is somewhat abstracted from the raw data that
the device driver offers.
API
The interface is centred around a JOYSTICK object (created by calling
MAKE-STICK with a suitable device name as argument). To read an event
from the device driver, call UPDATE-STICK with the joystick object as
argument.
Under SBCL (with thread support) there is a "continous poll" support
(simply call CONTINOUS-POLL with the joystick object as argument, to
terminate the polling thread, call TERMINATE-POLL with the object as
argument). All relevant locking is done, keyed on if a joystick is
polled or not
There are two arrays that are of interest in a joystick object
js. The first is the analog axes, (axes js) and the
second is the buttons (buttons js). The library currently
supports up to 8 analog axes and up to 24 buttons (and will most
likely crash in amusing ways, should these limits be too strict).
From imattsson at common-lisp.net Wed Dec 27 19:14:12 2006
From: imattsson at common-lisp.net (Ingvar Mattsson)
Date: Wed, 27 Dec 2006 19:14:12 +0000
Subject: [gamelib-cvs] stick-transfers.png
Message-ID: <20061227191412.20BBD49021@common-lisp.net>
Update of /project/gamelib/cvsroot/source/doc
In directory clnet:/tmp/cvs-serv28371
Added Files:
stick-transfers.png
Log Message:
IM
Initial check-in.
--- NEW FILE: stick-transfers.png ---
(This appears to be a binary file; contents omitted.)
From imattsson at common-lisp.net Wed Dec 27 19:27:26 2006
From: imattsson at common-lisp.net (Ingvar Mattsson)
Date: Wed, 27 Dec 2006 19:27:26 +0000
Subject: [gamelib-cvs] stick.html
Message-ID: <20061227192726.D343B4D005@common-lisp.net>
Update of /project/gamelib/cvsroot/source/doc
In directory clnet:/tmp/cvs-serv30530
Modified Files:
stick.html
Log Message:
IM
Better documentation and some explanatory graphs.
Index: stick.html
===================================================================
RCS file: /project/gamelib/cvsroot/source/doc/stick.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** stick.html 27 Dec 2006 16:29:57 -0000 1.1
--- stick.html 27 Dec 2006 19:27:24 -0000 1.2
***************
*** 37,41 ****
terminate the polling thread, call TERMINATE-POLL with the object as
argument). All relevant locking is done, keyed on if a joystick is
! polled or not
There are two arrays that are of interest in a joystick object
--- 37,42 ----
terminate the polling thread, call TERMINATE-POLL with the object as
argument). All relevant locking is done, keyed on if a joystick is
! polled or not. Still, the publicly available information will only be
! done after a call to UPDATE-STICK.
There are two arrays that are of interest in a joystick object
***************
*** 44,45 ****
--- 45,95 ----
supports up to 8 analog axes and up to 24 buttons (and will most
likely crash in amusing ways, should these limits be too strict).
+
+
As part of the update and transformation from signed 16-bit integers
+ to SINGLE-FLOAT, some transformations of the data can be done. The
+ (currently) available library functions are SIMPLE-TRANSFER (the
+ default), a simple division by 32768.0s0 and SQUARE-TRANSFER (the
+ result of a SIMPLE-TRANSFER, squared and multiplied by the
+ signum).
+
+
A graph displaying these two transfer functions (X axis is raw
+ joystick data, Y axis is the displacement along the axis available
+ from GAMES-STICK):
+
+
+
+
Full STICK package exported symbol list
+
+
(axes joystick)
+
Returns an array, with axis 0 at index 0, axis 1 at index 1 and
+ so on.
+
(buttons joystick)
+
Returns a bit-vector, with button 0 at index 0, button 1 at
+ index 1 and so forth. A value of 0 means "not pressed", a value of 1
+ means "pressed".
+
(make-stick device-file)
+
Create a joystick object for the named device.
+
(set-transfer joystickaxistransfer-fn)
+
Set the transfer function for axis to the desired transfer
+ function. A transfer function should map from [ -32768, 32767 ] to [
+ -1.0s0, 1.0s0 ].
+
(simple-transfer value)
+
A simple transfer function (linear mapping from the integer
+ range to the single-float range).
+
(square-transfer value)
+
A slightly more complex transfer function, causing less
+ sensitivity in the "close to centred" region and slightly higher
+ sensitivity in the more extreme regions.
+
(update-stick joystick)
+
Copy current (hidden) data to teh publicly available data. Also
+ applies the relevant transfer functions.
+
(continous-poll joystick)
+
Only available if build with :SB-THREAD available on
+ *FEATURES*. Start a separate thread reading from the device. Still
+ requires UPDATE-STICK to copy from private to pubic data.
+
(terminate-poll joystick)
+
Only available if build with :SB-THREAD available on
+ *FEATURES*. Terminate continous polling for a specific joystick.
+
+
+
From imattsson at common-lisp.net Wed Dec 27 20:18:37 2006
From: imattsson at common-lisp.net (Ingvar Mattsson)
Date: Wed, 27 Dec 2006 20:18:37 +0000
Subject: [gamelib-cvs] index.html
Message-ID: <20061227201837.2419561046@common-lisp.net>
Update of /project/gamelib/cvsroot/source/doc
In directory clnet:/tmp/cvs-serv3639
Modified Files:
index.html
Log Message:
IM
Added the joystick docs to the main page.
Index: index.html
===================================================================
RCS file: /project/gamelib/cvsroot/source/doc/index.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** index.html 23 Sep 2006 07:46:28 -0000 1.4
--- index.html 27 Dec 2006 20:18:34 -0000 1.5
***************
*** 27,32 ****