sge.joystick¶
Contents
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 as a float from
-1to1, where0is centered,-1is all the way to the left or up, and1is all the way to the right or down. Return0if the requested joystick or axis does not exist.Arguments:
joystick– The number of the joystick to check, where0is the first joystick, or the name of the joystick to check.axis– The number of the axis to check, where0is the first axis of the joystick.
-
sge.joystick.get_hat_x(joystick, hat)[source]¶ Return the horizontal position of a joystick hat (d-pad). Can be
-1(left),0(centered), or1(right). Return0if the requested joystick or hat does not exist.Arguments:
joystick– The number of the joystick to check, where0is the first joystick, or the name of the joystick to check.hat– The number of the hat to check, where0is the first hat of the joystick.
-
sge.joystick.get_hat_y(joystick, hat)[source]¶ Return the vertical position of a joystick hat (d-pad). Can be
-1(up),0(centered), or1(down). Return0if the requested joystick or hat does not exist.Arguments:
joystick– The number of the joystick to check, where0is the first joystick, or the name of the joystick to check.hat– The number of the hat to check, where0is the first hat of the joystick.
-
sge.joystick.get_pressed(joystick, button)[source]¶ Return whether or not a joystick button is pressed, or
Falseif the requested joystick or button does not exist.Arguments:
joystick– The number of the joystick to check, where0is the first joystick, or the name of the joystick to check.button– The number of the button to check, where0is the first button of the joystick.
-
sge.joystick.get_name(joystick)[source]¶ Return the name of a joystick, or
Noneif the requested joystick does not exist.Arguments:
joystick– The number of the joystick to check, where0is the first joystick, or the name of the joystick to check.
-
sge.joystick.get_id(joystick)[source]¶ Return the number of a joystick, where
0is the first joystick, orNoneif the requested joystick does not exist.Arguments:
joystick– The number of the joystick to check, where0is the first joystick, or the name of the joystick to check.
-
sge.joystick.get_axes(joystick)[source]¶ Return the number of axes available on a joystick, or
0if the requested joystick does not exist.Arguments:
joystick– The number of the joystick to check, where0is the first joystick, or the name of the joystick to check.
-
sge.joystick.get_hats(joystick)[source]¶ Return the number of hats (d-pads) available on a joystick, or
0if the requested joystick does not exist.Arguments:
joystick– The number of the joystick to check, where0is the first joystick, or the name of the joystick to check.
-
sge.joystick.get_trackballs(joystick)[source]¶ Return the number of trackballs available on a joystick, or
0if the requested joystick does not exist.Arguments:
joystick– The number of the joystick to check, where0is the first joystick, or the name of the joystick to check.
Return the number of buttons available on a joystick, or
0if the requested joystick does not exist.Arguments:
joystick– The number of the joystick to check, where0is the first joystick, or the name of the joystick to check.