diff options
Diffstat (limited to 'share/man/man4/joy.4')
-rw-r--r-- | share/man/man4/joy.4 | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/share/man/man4/joy.4 b/share/man/man4/joy.4 index 70d148e..76bcbc8 100644 --- a/share/man/man4/joy.4 +++ b/share/man/man4/joy.4 @@ -12,12 +12,19 @@ the PC joystick. .Pp This device may be opened by only one process at a time. .Pp -The joystick status is get in an array of 4 integers via a read() -call. -.br -The X and Y positions are stored in values 0 and 1 of the array, -and the state of the 2 buttons are stores in values 2 and 3 of the -array. Positions are typically in the range 0-2000. +The joystick status is get in an structure joystick via a read() +call. The structure is defined in the header file as follows: +.Pp +.Bd -literal -offset indent + struct joystick { + int x; /* x position */ + int y; /* y position */ + int b1; /* button 1 status */ + int b2; /* button 2 status */ + }; +.Ed +.Pp +Positions are typically in the range 0-2000. .Ss One line perl example: perl -e 'open(JOY,"/dev/joy0")||die;while(1) .br |