pygame / docs / ref / Joystick.html

<body bgcolor=#dddddd text=#333377 link=#7777bb vlink=#7777bb>

<table border=0 width=100% cellpadding=0 cellspacing=0 bgcolor=#f5f5f5><tr valign=top>
<td rowspan=2><table border=0 cellpadding=5 cellspacing=0 bgcolor=#333377>
<tr height=86 align=left><td valign=middle><font color=#ffffff size=+5>
	<a href=../index.html><font size=+5 color=#ffffff><i><b>
<td valign=middle><tt><font color=#dddddd><br>
</td></tr></table></td><td width=100% align=center valign=middle>

	<a href=>Home</a> &nbsp;||&nbsp;
	<a href=../index.html>Help Contents</a> &nbsp;||

|| <a href=CD.html>CD</a> || 
<a href=Channel.html>Channel</a> || 
<a href=Font.html>Font</a> || 
<a href=Joystick.html>Joystick</a> || 
<a href=Rect.html>Rect</a> || 
<a href=Sound.html>Sound</a> || 
<a href=Surface.html>Surface</a> ||<br>
|| <a href=pygame.html>pygame</a> || 
<a href=pygame_cdrom.html>cdrom</a> || 
<a href=pygame_constants.html>constants</a> || 
<a href=pygame_display.html>display</a> || 
<a href=pygame_event.html>event</a> || 
<a href=pygame_font.html>font</a> || 
<a href=pygame_image.html>image</a> ||<br>
|| <a href=pygame_joystick.html>joystick</a> || 
<a href=pygame_key.html>key</a> || 
<a href=pygame_mixer.html>mixer</a> || 
<a href=pygame_mixer_music.html>mixer_music</a> || 
<a href=pygame_mouse.html>mouse</a> || 
<a href=pygame_music.html>music</a> || 
<a href=pygame_surfarray.html>surfarray</a> ||<br>
|| <a href=pygame_time.html>time</a> ||<br>

<h2 align=center>Joystick</h2>
Thin object wrapper around the SDL joystick
interface. Likely to be changed.


<tr><td><a href=#get_axes>get_axes</a></td><td> -
query number of axis</td></tr>

<tr><td><a href=#get_axis>get_axis</a></td><td> -
query axis of a joystick</td></tr>

<tr><td><a href=#get_balls>get_balls</a></td><td> -
query number of balls</td></tr>

<tr><td><a href=#get_button>get_button</a></td><td> -
query state of button</td></tr>

<tr><td><a href=#get_buttons>get_buttons</a></td><td> -
query number of buttons</td></tr>

<tr><td><a href=#get_hat>get_hat</a></td><td> -
query position of hat</td></tr>

<tr><td><a href=#get_hats>get_hats</a></td><td> -
query number of hats</td></tr>

<tr><td><a href=#get_id>get_id</a></td><td> -
query id of joystick</td></tr>



<a name=get_axes><font size=+2><b>get_axes
</b></font><br><font size=+1><tt>
Joystick.get_axes() -> count
Returns the number of axis on this Joystick

<a name=get_axis><font size=+2><b>get_axis
</b></font><br><font size=+1><tt>
Joystick.get_axis(axis) -> position
Returns the current position of an axis control on
the Joystick. Value is in the range -1.0 to 1.0.

<a name=get_balls><font size=+2><b>get_balls
</b></font><br><font size=+1><tt>
Joystick.get_balls() -> count
Returns number of trackballs on this Joystick

<a name=get_button><font size=+2><b>get_button
</b></font><br><font size=+1><tt>
Joystick.get_button(button) -> bool
Returns true if the given Joystick button is being

<a name=get_buttons><font size=+2><b>get_buttons
</b></font><br><font size=+1><tt>
Joystick.get_buttons() -> count
Returns number of pushable buttons on this

<a name=get_hat><font size=+2><b>get_hat
</b></font><br><font size=+1><tt>
Joystick.get_hat(pov_hat) -> state
Returns the current position of a directional hat
on the Joystick. Value in a position on the
following compass. (think 1 is up, and goes around
8 1 2
7 0 3
6 5 4

<a name=get_hats><font size=+2><b>get_hats
</b></font><br><font size=+1><tt>
Joystick.get_hats() -> count
Returns number of directional hats on this

<a name=get_id><font size=+2><b>get_id
</b></font><br><font size=+1><tt>
Joystick.get_id() -> id
Returns the joystick id number for the Joystick