Skip to content

key_map

gamepad

BosiWirelessGXT590

Key-map for Bosi Wireless Gamepad GXT 590

XBox360Wireless

Key-map for XBox 360 Wireless Controller

XBoxWireless

Key-map for XBox Wireless Controller

GamePad

Stores key- and joystick maps.

__init__(self, name, key_map, joystick_map, analog_range) special

Creates used controller with related maps

Parameters:

Name Type Description Default
name str

name of controller

required
key_map dict

contains code from controller and associated sdk-code for the switch

required
joystick_map dict

contains code from controller and associated sdk-code the joystick

required
Source code in game_sdk/controller/key_map/gamepad.py
def __init__(self, name: str, key_map: dict, joystick_map: dict, analog_range: int):
    """
        Creates used controller with related maps

        Arguments:
            name: name of controller
            key_map: contains code from controller and associated sdk-code for the switch
            joystick_map: contains code from controller and associated sdk-code the joystick
    """
    self.name = name
    self.analog_range = analog_range
    self._key_map = key_map
    self._joystick_map = joystick_map

map_key(self, code)

Get sdk-code for switch and joystick movements

Parameters:

Name Type Description Default
code int

original code from controller

required
Source code in game_sdk/controller/key_map/gamepad.py
def map_key(self, code: int) -> Enum:
    """
        Get sdk-code for switch and joystick movements

        Arguments:
            code: original code from controller
    """
    if(code in self._key_map):
        return self._key_map[code]
    elif(code in self._joystick_map):
        return self._joystick_map[code]
    else:
        logging.warning("Key Code %s not found", code)

JoystickCode (Enum)

Shortcuts for the joystick

KeyCode (Enum)

Shortcuts for buttons

Back to top