Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
0a3042b93c | |||
73fecc1904 | |||
ed252a6548 | |||
ad3214dd23 | |||
311b047bf5 | |||
13901aeb50 | |||
5f3f25cc8c | |||
96ae8860d5 |
@@ -3,4 +3,4 @@
|
|||||||
Small module to make it easy to add controller support.
|
Small module to make it easy to add controller support.
|
||||||
|
|
||||||

|

|
||||||

|

|
1
main.py
1
main.py
@@ -4,7 +4,6 @@ from pygameControls import globals
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
pygame.init()
|
pygame.init()
|
||||||
globals.init()
|
|
||||||
|
|
||||||
done = False
|
done = False
|
||||||
|
|
||||||
|
@@ -1,20 +1,18 @@
|
|||||||
import pygame
|
import pygame
|
||||||
from . import globals
|
from . import globals
|
||||||
|
|
||||||
__version__ = "0.2.3"
|
__version__ = "0.2.7"
|
||||||
|
|
||||||
class Controllers:
|
class Controllers:
|
||||||
def __init__(self, joy):
|
def __init__(self, joy):
|
||||||
|
globals.init()
|
||||||
self.controllers = []
|
self.controllers = []
|
||||||
cont = self.detect_controller(joy.get_guid())
|
cont = self.detect_controller(joy.get_guid())
|
||||||
print(cont)
|
|
||||||
self.controllers.append(cont(joy))
|
self.controllers.append(cont(joy))
|
||||||
|
|
||||||
def detect_controller(self, guid):
|
def detect_controller(self, guid):
|
||||||
for gp in globals.GAMEPADS:
|
for gp in globals.GAMEPADS:
|
||||||
print(gp)
|
|
||||||
for p in globals.GAMEPADS[gp]:
|
for p in globals.GAMEPADS[gp]:
|
||||||
print(p)
|
|
||||||
if p["guid"] != guid:
|
if p["guid"] != guid:
|
||||||
continue
|
continue
|
||||||
return p["class"]
|
return p["class"]
|
||||||
|
@@ -183,7 +183,7 @@ def init():
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"vidpid": "046d:c21d",
|
"vidpid": "046d:c21d",
|
||||||
"guid": "",
|
"guid": "0333443e6d0400001fc2000005030000",
|
||||||
"connection": ConnectionType.USB,
|
"connection": ConnectionType.USB,
|
||||||
"input": InputType.XInput,
|
"input": InputType.XInput,
|
||||||
"name": [
|
"name": [
|
||||||
@@ -194,14 +194,15 @@ def init():
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"vidpid": "046d:c216",
|
"vidpid": "046d:c216",
|
||||||
"guid": "",
|
"guid": "03005d8e6d04000019c2000011010000",
|
||||||
"connection": ConnectionType.USB,
|
"connection": ConnectionType.USB,
|
||||||
"input": InputType.DirectInput,
|
"input": InputType.DirectInput,
|
||||||
"name": [
|
"name": [
|
||||||
"Logitech, Inc. F710 Gamepad [DirectInput Mode]",
|
"Logitech, Inc. F710 Gamepad [DirectInput Mode]",
|
||||||
"Logitech Dual Action"
|
"Logitech Dual Action",
|
||||||
|
"Logitech Cordless Rumblepad 2"
|
||||||
],
|
],
|
||||||
"class": CONTROLLERS["Logitech Dual Action"]
|
"class": CONTROLLERS["Logitech Rumblepad 2"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
Reference in New Issue
Block a user