1joystick_sethandler(3) Svgalib User Manual joystick_sethandler(3)
2
3
4
6 joystick_sethandler, joystick_setdefaulthandler - set the joystick
7 event handler.
8
10 #include <vgajoystick.h>
11 typedef void (*__joystick_handler) (int event, int number, char value,
12 int joydev);
13
14 void joystick_sethandler(int joydev, __joystick_handler jh);
15 void joystick_setdefaulthandler(int joydev);
16
17
19 By default, each call to joystick_init(3) enables the default handler
20 for the opened joystick. This handler maintains a state table which can
21 be read by the joystick_getaxis(3), joystick_getbutton(3), joy‐
22 stick_button1|2|3|4(3), joystick_getb1|2|3|4(3), joystick_x|y|z(3) and
23 joystick_getx|y|z(3) functions.
24
25 If you define an own handler, the following parameters are passed:
26
27
28 event one of the following values:
29
30 JOY_EVENTBUTTONDOWN a button was pressed.
31
32 JOY_EVENTBUTTONUP a button was released.
33
34 JOY_EVENTAXIS the joystick position was changed.
35
36
37 All other values are reserved for future use.
38
39
40 number identifies the button or axis to which this event
41 belongs.
42
43
44 value for axis events the new position in range -128 .. 127.See
45 joystick_getaxis(3) for further comments on the range.
46
47
48 joydev identifies the joystick affected (this allows to use one
49 handler for many joysticks).
50
51 joydev = -1 modifies the event handler of all currently open joystick
52 devices.
53
54
56 This function is only available in ELF versions of svgalib. Due to
57 backwards compatibility issues it cannot be used with shared a.out
58 libs.
59
60
62 svgalib(7), vgagl(7), libvga.config(5), joytest(6), mjoytest(6), joy‐
63 stick_init(3), joystick_close(3), joystick_update(3), joystick_getnu‐
64 maxes(3), joystick_getnumbuttons(3), joystick_getaxis(3), joystick_get‐
65 button(3), joystick_button1(3), joystick_getb1(3), joystick_x(3), joy‐
66 stick_getx(3).
67
68
70 The svgalib joystick handler was mostly done by Daniel Engstr\"om
71 <daniel.engstrom@riksnett.no>. Multiple joystick, VC switching support
72 and code to glue it into svgalib by Michael Weller <eowmob@exp-
73 math.uni-essen.de>. Part of the code is based on code from C. Smith and
74 Vojtech Pavlik.
75
76
77
78Svgalib 1.3.0 14 April 1998 joystick_sethandler(3)