Beispiel #1
0
    def reset(self):
        """Resets the state of all inputs to their default state."""
        # Obtain the current state of all inputs
        axis_states = {}
        button_states = {}
        hat_states = {}

        for i, axis in self._axis.items():
            axis_states[i] = axis.value
        for i, button in self._button.items():
            button_states[i] = button.is_pressed
        for i, hat in self._hat.items():
            hat_states[i] = hat.direction

        # Perform reset using default vJoy functionality
        success = VJoyInterface.ResetVJD(self.vjoy_id)

        # Restore input states based on what we recorded
        if success:
            for i in self._axis:
                self._axis[i].set_absolute_value(axis_states[i])
            for i in self._button:
                self._button[i].is_pressed = button_states[i]
            for i in self._hat:
                self._hat[i].direction = hat_states[i]
        else:
            logging.getLogger("system").info(
                "Could not reset vJoy device, are we using it?")
Beispiel #2
0
    def reset(self):
        """Resets the state of all inputs to their default state."""
        # Obtain the current state of all inputs
        axis_states = {}
        button_states = {}
        hat_states = {}

        for i, axis in self._axis.items():
            axis_states[i] = axis.value
        for i, button in self._button.items():
            button_states[i] = button.is_pressed
        for i, hat in self._hat.items():
            hat_states[i] = hat.direction

        # Perform reset using default vJoy functionality
        VJoyInterface.ResetVJD(self.vjoy_id)

        # Restore input states based on what we recorded
        for i in self._axis:
            self._axis[i].value = axis_states[i]
        for i in self._button:
            self._button[i].is_pressed = button_states[i]
        for i in self._hat:
            self._hat[i].direction = hat_states[i]