2
<title>pygame.joystick</title>
3
<body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111>
6
<table cellspacing=3 width=100%><tr><td bgcolor=#00000>
7
<table width=100%><tr><td bgcolor=c2fc20 align=center>
8
<a href=http://www.pygame.org>
9
<img src=../pygame_tiny.gif border=0 width=200 height=60></a><br>
10
<b>pygame documentation</b>
11
</td><td bgcolor=6aee28 align=center valign=top width=100%>
14
<a href=http://www.pygame.org>Home</a> ||
15
<a href=../index.html>Help Contents</a> ||
18
|| <a href=pygame.html>pygame</a> ||
19
<a href=pygame_cdrom.html>cdrom</a> ||
20
<a href=pygame_constants.html>constants</a> ||
21
<a href=pygame_display.html>display</a> ||
22
<a href=pygame_draw.html>draw</a> ||
23
<a href=pygame_event.html>event</a> ||<br>
24
|| <a href=pygame_font.html>font</a> ||
25
<a href=pygame_image.html>image</a> ||
26
<a href=pygame_joystick.html>joystick</a> ||
27
<a href=pygame_key.html>key</a> ||
28
<a href=pygame_mixer.html>mixer</a> ||
29
<a href=pygame_mixer_music.html>mixer_music</a> ||<br>
30
|| <a href=pygame_mouse.html>mouse</a> ||
31
<a href=pygame_movie.html>movie</a> ||
32
<a href=pygame_surfarray.html>surfarray</a> ||
33
<a href=pygame_time.html>time</a> ||
34
<a href=pygame_transform.html>transform</a> ||<br>
35
<br>|| <a href=CD.html>CD</a> ||
36
<a href=Channel.html>Channel</a> ||
37
<a href=Clock.html>Clock</a> ||
38
<a href=Font.html>Font</a> ||
39
<a href=Joystick.html>Joystick</a> ||
40
<a href=Movie.html>Movie</a> ||<br>
41
|| <a href=Rect.html>Rect</a> ||
42
<a href=Sound.html>Sound</a> ||
43
<a href=Surface.html>Surface</a> ||<br>
44
<br>|| <a href=pygame_cursors.html>cursors</a> ||
45
<a href=pygame_sprite.html>sprite</a> ||
46
<a href=pygame_version.html>version</a> ||<br>
49
</td></tr></table></td></tr></table>
51
<h2 align=center>pygame.joystick</h2>
52
The joystick module provides a few functions to initialize
53
the joystick subsystem and to manage the Joystick objects. These
54
objects are created with the <a href=#Joystick>pygame.joystick.Joystick()</a> function.
55
This function needs a joystick device number to work on. All
56
joystick devices on the system are enumerated for use as a Joystick
57
object. To access most of the Joystick functions, you'll need to
58
<a href=pygame.html#init>init()</a> the Joystick. (note that the joystick module will already
59
be initialized). When multiple Joysticks objects are created for the
60
same joystick device, the state and values for those Joystick objects
63
You can call the <a href=Joystick.html#get_name>Joystick.get_name()</a> and <a href=Joystick.html#get_id>Joystick.get_id()</a> functions
64
without initializing the Joystick object.
66
Joystick control values are only updated during the calls to the event
67
queue. Call <a href=pygame_event.html#pump>pygame.event.pump()</a> if you are not using the event queue for
68
any input handling. Once a joystick object has been initialized, it will
69
start to send joystick events to the input queue.
71
Be sure to understand there is a difference between the joystick module
72
and the Joystick objects.
77
<tr><td><a href=#Joystick>Joystick</a></td><td> -
78
create new joystick object</td></tr>
81
<tr><td><a href=#get_count>get_count</a></td><td> -
82
query number of joysticks on system</td></tr>
85
<tr><td><a href=#get_init>get_init</a></td><td> -
86
query initialization of joystick module</td></tr>
89
<tr><td><a href=#init>init</a></td><td> -
90
initialize joystick module</td></tr>
93
<tr><td><a href=#quit>quit</a></td><td> -
94
uninitialize joystick module</td></tr>
101
<a name=Joystick><font size=+2><b>Joystick
102
</b></font><br><font size=+1><tt>
103
pygame.joystick.Joystick(id) -> Joystick
105
Creates a new joystick object for the given device id. The given id
106
must be less than the value from <a href=#get_count>pygame.joystick.get_count()</a>.
109
<a name=get_count><font size=+2><b>get_count
110
</b></font><br><font size=+1><tt>
111
pygame.joystick.get_count() -> int
113
Returns the number of joysticks devices available on
117
<a name=get_init><font size=+2><b>get_init
118
</b></font><br><font size=+1><tt>
119
pygame.joystick.get_init() -> bool
121
Returns true when the joystick module is initialized.
124
<a name=init><font size=+2><b>init
125
</b></font><br><font size=+1><tt>
126
pygame.joystick.init() -> None
128
Initialize the joystick module manually
131
<a name=quit><font size=+2><b>quit
132
</b></font><br><font size=+1><tt>
133
pygame.joystick.quit() -> None
135
Uninitialize the joystick module manually