Addiing individual controller support. /JL

This commit is contained in:
2025-04-13 12:55:39 +02:00
parent 724123e569
commit c99c9945cf
15 changed files with 1159 additions and 78 deletions

View File

@@ -26,9 +26,9 @@ def load_image(path, max_size):
new_size = (int(image_rect.width * scale_factor), int(image_rect.height * scale_factor))
return pygame.transform.smoothscale(image, new_size)
keyboard_image = load_image("keyboard.png", (100, 100))
keyboard_image = load_image("resources/gfx/keyboard.png", (100, 100))
#joystick_image = load_image("ps5-dualsense.png", (100, 100))
joystick_image = load_image("gamepad.png", (100, 100))
joystick_image = load_image("resources/gfx/gamepad.png", (100, 100))
# Abstract Control Class
class Control(ABC):

View File

@@ -57,7 +57,7 @@ def main():
print("Joystick button pressed.")
if event.button == 0:
joystick = joysticks[event.instance_id]
if joystick.rumble(0, 0.7, 500):
if joystick.rumble(0.7, 1.0, 1000):
print(f"Rumble effect played on joystick {event.instance_id}")
if event.type == pygame.JOYBUTTONUP: