Skip to content

Joystick

Class for all joystick inputs

__init__(self, seat, name) special

Initializes the joystick

Parameters:

Name Type Description Default
seat int

controller seat

required
name str

controller name

required
Source code in game_sdk/controller/inputs/joystick.py
def __init__(self, seat: int, name: str):
    """
        Initializes the joystick

        Arguments:
            seat: controller seat
            name: controller name
    """
    super().__init__(seat, name)

get_direction(self, seat, pos) async

Called with directions from the joystick

Parameters:

Name Type Description Default
pos float

coordinate of movement (from -1 to 1)

required
Source code in game_sdk/controller/inputs/joystick.py
async def get_direction(self, seat: int, pos: float):
    """
        Called with directions from the joystick

        Arguments:
            pos: coordinate of movement (from -1 to 1)
    """

    logging.info("Set direction of %s to %s", self.name, pos)
Back to top