emGetController.3p
1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
.TH emGetController 3P local "Silicon Graphics, Inc."
.SH NAME
emGetController \- Get current state of the game controller
.SH C SPECIFICATION
#include "em.h"
.br
.sp
int emGetController(int port, GamePad *pad)
.SH PARAMETERS
.TP 10
.I port
tty port number
.TP
.I pad
Pointer to Gamepad structure
.SH DESCRIPTION
Poll the current state of the game controller that is connected to the
specified port.
The contents of the GamePad structure is as follows:
.sp
.nf
typedef struct {
unsigned short button; /* all of the 14 buttons */
unsigned char stick_x;
unsigned char stick_y;
} GamePad;
.fi
.sp
The bit positions of the 14 buttons are listed in em.h.
A value of one means the button is pressed.
.sp
The joystick x and y values range from 0 to 255.
(0,0) is up and to the right. (255,255) is down and to the left.
.sp
.I emInitController
must be called before
.I emGetController
is used.
.SH NOTES
The current joystick has a range from 0 to 255.
The final joystick will have a range from 0 to 127.
The current joystick doesn't return to the mid point of the range.
The bit positions of the buttons may change.
.SH RETURN VALUE
Returns 0 on success and -1 on failure.
.SH SEE ALSO
.TP 10
emulate(1P), emInitController(3P)