sge.joystick
This module provides functions related to joystick input.
sge.joystick Functions
-
sge.joystick.refresh()[source]
Refresh the SGE’s knowledge of joysticks.
Call this method to allow the SGE to use joysticks that were plugged
in while the game was running.
-
sge.joystick.get_axis(joystick, axis)[source]
Return the position of a joystick axis.
Arguments:
- joystick – The number of the joystick to check, where 0
is the first joystick, or the name of the joystick to check.
- axis – The number of the axis to check, where 0 is the
first axis of the joystick.
Return a float from -1 to 1, where 0 is centered, -1
is all the way to the left or up, and 1 is all the way to the
right or down. Return 0 if the requested joystick or axis does
not exist.
-
sge.joystick.get_hat_x(joystick, hat)[source]
Return the horizontal position of a joystick hat (d-pad).
Arguments:
- joystick – The number of the joystick to check, where 0
is the first joystick, or the name of the joystick to check.
- hat – The number of the hat to check, where 0 is the
first hat of the joystick.
Return -1 (left), 0 (centered), or 1 (right). Return
0 if the requested joystick or hat does not exist.
-
sge.joystick.get_hat_y(joystick, hat)[source]
Return the vertical position of a joystick hat (d-pad).
Arguments:
- joystick – The number of the joystick to check, where 0
is the first joystick, or the name of the joystick to check.
- hat – The number of the hat to check, where 0 is the
first hat of the joystick.
Return -1 (up), 0 (centered), or 1 (down). Return 0
if the requested joystick or hat does not exist.
-
sge.joystick.get_pressed(joystick, button)[source]
Return whether or not a joystick button is pressed.
Arguments:
- joystick – The number of the joystick to check, where 0
is the first joystick, or the name of the joystick to check.
- button – The number of the button to check, where 0 is
the first button of the joystick.
joystick is the number of the joystick to check, where 0 is
the first joystick. button is the number of the button to
check, where 0 is the first button of the joystick.
Return False if the requested joystick or button does not
exist.
-
sge.joystick.get_joysticks()[source]
Return the number of joysticks available.
-
sge.joystick.get_name(joystick)[source]
Return the name of a joystick.
Arguments:
- joystick – The number of the joystick to check, where 0
is the first joystick, or the name of the joystick to check.
Return None if the requested joystick does not exist.
-
sge.joystick.get_id(joystick)[source]
Return the number of a joystick, where 0 is the first joystick.
Arguments:
- joystick – The number of the joystick to check, where 0
is the first joystick, or the name of the joystick to check.
Return None if the requested joystick does not exist.
-
sge.joystick.get_axes(joystick)[source]
Return the number of axes available on a joystick.
Arguments:
- joystick – The number of the joystick to check, where 0
is the first joystick, or the name of the joystick to check.
Return 0 if the requested joystick does not exist.
-
sge.joystick.get_hats(joystick)[source]
Return the number of HATs available on a joystick.
Arguments:
- joystick – The number of the joystick to check, where 0
is the first joystick, or the name of the joystick to check.
Return 0 if the requested joystick does not exist.
-
sge.joystick.get_trackballs(joystick)[source]
Return the number of trackballs available on a joystick.
Arguments:
- joystick – The number of the joystick to check, where 0
is the first joystick, or the name of the joystick to check.
Return 0 if the requested joystick does not exist.
-
sge.joystick.get_buttons(joystick)[source]
Return the number of buttons available on a joystick.
Arguments:
- joystick – The number of the joystick to check, where 0
is the first joystick, or the name of the joystick to check.
Return 0 if the requested joystick does not exist.