Files
PyGame-Controller/pygameControls/controller.py
Jan Lerking 96ae8860d5
Some checks failed
Run Controller Tests / test (push) Has been cancelled
Updated initialization code. /JL
2025-05-07 21:40:40 +02:00

22 lines
601 B
Python

import pygame
from . import globals
__version__ = "0.2.4"
class Controllers:
def __init__(self, joy):
globals.init()
self.controllers = []
cont = self.detect_controller(joy.get_guid())
print(cont)
self.controllers.append(cont(joy))
def detect_controller(self, guid):
for gp in globals.GAMEPADS:
print(gp)
for p in globals.GAMEPADS[gp]:
print(p)
if p["guid"] != guid:
continue
return p["class"]
return globals.CONTROLLERS["Generic Controller"]