pygameControls 0.1.12__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pygameControls/controller.py +15 -27
- pygameControls/dualsense_controller.py +2 -0
- pygameControls/dualsense_edge_controller.py +2 -0
- pygameControls/enums.py +12 -0
- pygameControls/generic_controller.py +1 -0
- pygameControls/globals.py +207 -0
- pygameControls/logitech_dual_action_controller.py +1 -14
- pygameControls/logitech_f310_controller.py +1 -14
- pygameControls/logitech_f510_controller.py +7 -37
- pygameControls/logitech_f710_controller.py +5 -37
- pygameControls/{dualshock3_controller.py → playstation3_controller.py} +3 -1
- pygameControls/playstation4_controller.py +72 -0
- pygameControls/sony_playstation3_controller.py +72 -0
- pygameControls/sony_playstation4_controller.py +72 -0
- pygameControls/xbox_360_controller.py +69 -0
- pygameControls/xbox_series_x_controller.py +2 -0
- {pygamecontrols-0.1.12.dist-info → pygamecontrols-0.2.0.dist-info}/METADATA +1 -1
- pygamecontrols-0.2.0.dist-info/RECORD +23 -0
- {pygamecontrols-0.1.12.dist-info → pygamecontrols-0.2.0.dist-info}/WHEEL +1 -1
- pygamecontrols-0.1.12.dist-info/RECORD +0 -17
- {pygamecontrols-0.1.12.dist-info → pygamecontrols-0.2.0.dist-info}/licenses/LICENSE +0 -0
- {pygamecontrols-0.1.12.dist-info → pygamecontrols-0.2.0.dist-info}/top_level.txt +0 -0
pygameControls/controller.py
CHANGED
@@ -1,33 +1,21 @@
|
|
1
1
|
import pygame
|
2
|
-
from .
|
3
|
-
from .dualsense_controller import DualSenseController
|
4
|
-
from .dualsense_edge_controller import DualSenseEdgeController
|
5
|
-
from .logitech_f310_controller import LogitechF310Controller
|
6
|
-
from .logitech_f510_controller import LogitechF510Controller
|
7
|
-
from .logitech_f710_controller import LogitechF710Controller
|
8
|
-
from .xbox_series_x_controller import XboxSeriesXController
|
9
|
-
from .dualshock3_controller import DualShock3Controller
|
10
|
-
from .generic_controller import GenericController
|
11
|
-
from .logitech_dual_action_controller import LogitechDualActionController
|
2
|
+
from . import globals
|
12
3
|
|
13
|
-
__version__ = "0.
|
14
|
-
|
15
|
-
CONTROLLERS = {
|
16
|
-
"DualSense Wireless Controller": DualSenseController,
|
17
|
-
"DualSense Edge Wireless Controller": DualSenseEdgeController,
|
18
|
-
"Logitech Gamepad F310": LogitechF310Controller,
|
19
|
-
"Logitech Gamepad F510": LogitechF510Controller,
|
20
|
-
"Logitech Gamepad F710": LogitechF710Controller,
|
21
|
-
"Logitech Dual Action": LogitechDualActionController,
|
22
|
-
"Xbox Series X Controller": XboxSeriesXController,
|
23
|
-
"PLAYSTATION(R)3 Controller": DualShock3Controller
|
24
|
-
}
|
4
|
+
__version__ = "0.2.0"
|
25
5
|
|
26
6
|
class Controllers:
|
27
7
|
def __init__(self, joy):
|
28
8
|
self.controllers = []
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
9
|
+
cont = self.detect_controller(joy.get_guid())
|
10
|
+
print(cont)
|
11
|
+
self.controllers.append(cont(joy))
|
12
|
+
|
13
|
+
def detect_controller(self, guid):
|
14
|
+
for gp in globals.GAMEPADS:
|
15
|
+
print(gp)
|
16
|
+
for p in globals.GAMEPADS[gp]:
|
17
|
+
print(p)
|
18
|
+
if p["guid"] != guid:
|
19
|
+
continue
|
20
|
+
return p["class"]
|
21
|
+
return globals.CONTROLLERS["Generic Controller"]
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from pygameControls.controlsbase import ControlsBase
|
2
|
+
from .enums import ConnectionType
|
2
3
|
from pydualsense import *
|
3
4
|
|
4
5
|
BATTERY_STATE = {
|
@@ -15,6 +16,7 @@ class DualSenseController(ControlsBase):
|
|
15
16
|
self.device = pydualsense()
|
16
17
|
self.device.init()
|
17
18
|
self.name = self.device.device.get_product_string()
|
19
|
+
self.guid = self.device.get_guid()
|
18
20
|
self.powerlevel = self.device.battery.Level
|
19
21
|
self.batterystate = BATTERY_STATE[str(self.device.battery.State)]
|
20
22
|
self.set_player_id(PlayerID.PLAYER_1)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from pygameControls.controlsbase import ControlsBase
|
2
|
+
from enums import ConnectionType
|
2
3
|
from pydualsense import *
|
3
4
|
|
4
5
|
|
@@ -7,6 +8,7 @@ class DualSenseEdgeController(ControlsBase):
|
|
7
8
|
self.device = pydualsense()
|
8
9
|
self.device.init()
|
9
10
|
self.name = self.device.device.get_product_string()
|
11
|
+
self.guid = self.device.get_guid()
|
10
12
|
self.powerlevel = self.device.battery.Level
|
11
13
|
self.batterystate = BATTERY_STATE[str(self.device.battery.State)]
|
12
14
|
self.set_player_id(PlayerID.PLAYER_1)
|
pygameControls/enums.py
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
from .enums import ConnectionType, InputType
|
2
|
+
|
3
|
+
from .controlsbase import ControlsBase
|
4
|
+
from .dualsense_controller import DualSenseController
|
5
|
+
from .dualsense_edge_controller import DualSenseEdgeController
|
6
|
+
from .logitech_f310_controller import LogitechF310Controller
|
7
|
+
from .logitech_f510_controller import LogitechF510Controller
|
8
|
+
from .logitech_f710_controller import LogitechF710Controller
|
9
|
+
from .xbox_series_x_controller import XboxSeriesXController
|
10
|
+
from .sony_playstation3_controller import SonyPlayStation3Controller
|
11
|
+
from .playstation3_controller import PlayStation3Controller
|
12
|
+
from .sony_playstation4_controller import SonyPlayStation4Controller
|
13
|
+
from .playstation4_controller import PlayStation4Controller
|
14
|
+
from .generic_controller import GenericController
|
15
|
+
from .logitech_dual_action_controller import LogitechDualActionController
|
16
|
+
|
17
|
+
def init():
|
18
|
+
global VID_PID
|
19
|
+
VID_PID = {
|
20
|
+
"046d:c216": "Logitech Gamepad F310",
|
21
|
+
"046d:c21d": "Microsoft X-Box 360 pad",
|
22
|
+
"046d:c21d": "Logitech Dual Action",
|
23
|
+
"045e:0b12": "Xbox Series X Controller",
|
24
|
+
"045e:0b13": "Xbox Series X Controller",
|
25
|
+
"045e:0b20": "Xbox Series X Controller",
|
26
|
+
"045e:0b21": "Xbox Series X Controller",
|
27
|
+
"054c:0ce6": "DualSense Wireless Controller",
|
28
|
+
"054c:0df2": "DualSense Wireless Controller",
|
29
|
+
}
|
30
|
+
global CONTROLLERS
|
31
|
+
CONTROLLERS = {
|
32
|
+
"DualSense Wireless Controller": DualSenseController,
|
33
|
+
"DualSense Edge Wireless Controller": DualSenseEdgeController,
|
34
|
+
"Logitech Gamepad F310": LogitechF310Controller,
|
35
|
+
"Logitech Gamepad F510": LogitechF510Controller,
|
36
|
+
"Logitech Gamepad F710": LogitechF710Controller,
|
37
|
+
"Logitech Dual Action": LogitechDualActionController,
|
38
|
+
"Microsoft X-Box 360 pad": LogitechDualActionController,
|
39
|
+
"Xbox Series X Controller": XboxSeriesXController,
|
40
|
+
"Sony PLAYSTATION(R)3 Controller": SonyPlayStation3Controller,
|
41
|
+
"PLAYSTATION(R)3 Controller": PlayStation3Controller,
|
42
|
+
"Sony PLAYSTATION(R)4 Controller": SonyPlayStation4Controller,
|
43
|
+
"PLAYSTATION(R)4 Controller": PlayStation4Controller,
|
44
|
+
"Generic Controller": GenericController
|
45
|
+
}
|
46
|
+
global GAMEPADS
|
47
|
+
GAMEPADS = {
|
48
|
+
"Sony Controller": [
|
49
|
+
{
|
50
|
+
"vidpid": "054c:0ce6",
|
51
|
+
"guid": "0300fd574c050000e60c000011810000",
|
52
|
+
"connection": ConnectionType.USB,
|
53
|
+
"input": InputType.DirectInput,
|
54
|
+
"name": [
|
55
|
+
"Sony Interactive Entertainment DualSense Wireless Controller",
|
56
|
+
"Sony Corp. DualSense wireless controller (PS5)",
|
57
|
+
"DualSense Wireless Controller"
|
58
|
+
],
|
59
|
+
"class": CONTROLLERS["DualSense Wireless Controller"]
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"vidpid": "054c:0df2",
|
63
|
+
"guid": "050057564c050000e60c000000810000",
|
64
|
+
"connection": ConnectionType.BLUETOOTH,
|
65
|
+
"input": InputType.DirectInput,
|
66
|
+
"name": [
|
67
|
+
"DualSense Wireless Controller"
|
68
|
+
],
|
69
|
+
"class": CONTROLLERS["DualSense Wireless Controller"]
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"vidpid": "054c:0dfc",
|
73
|
+
"guid": "",
|
74
|
+
"connection": ConnectionType.USB,
|
75
|
+
"input": InputType.DirectInput,
|
76
|
+
"name": ["DualSense Edge Wireless Controller"],
|
77
|
+
"class": CONTROLLERS["DualSense Edge Wireless Controller"]
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"vidpid": "054c:0dfc",
|
81
|
+
"guid": "",
|
82
|
+
"connection": ConnectionType.BLUETOOTH,
|
83
|
+
"input": InputType.DirectInput,
|
84
|
+
"name": ["DualSense Edge Wireless Controller"],
|
85
|
+
"class": CONTROLLERS["DualSense Edge Wireless Controller"]
|
86
|
+
},
|
87
|
+
{
|
88
|
+
"vidpid": "054c:0268",
|
89
|
+
"guid": "0300afd34c0500006802000011810000",
|
90
|
+
"connection": ConnectionType.USB,
|
91
|
+
"input": InputType.DirectInput,
|
92
|
+
"name": ["Sony PLAYSTATION(R)3 Controller"],
|
93
|
+
"class": CONTROLLERS["Sony PLAYSTATION(R)3 Controller"]
|
94
|
+
},
|
95
|
+
{
|
96
|
+
"vidpid": "",
|
97
|
+
"guid": "0500f9d24c0500006802000000800000",
|
98
|
+
"connection": ConnectionType.BLUETOOTH,
|
99
|
+
"input": InputType.DirectInput,
|
100
|
+
"name": ["PLAYSTATION(R)3 Controller"],
|
101
|
+
"class": CONTROLLERS["PLAYSTATION(R)3 Controller"]
|
102
|
+
},
|
103
|
+
{
|
104
|
+
"vidpid": "054c:05c4",
|
105
|
+
"guid": "",
|
106
|
+
"connection": ConnectionType.USB,
|
107
|
+
"input": InputType.DirectInput,
|
108
|
+
"name": ["DualShock 4 v1 Controller"],
|
109
|
+
"class": CONTROLLERS["PLAYSTATION(R)4 Controller"]
|
110
|
+
},
|
111
|
+
{
|
112
|
+
"vidpid": "054c:05c4",
|
113
|
+
"guid": "",
|
114
|
+
"connection": ConnectionType.BLUETOOTH,
|
115
|
+
"input": InputType.DirectInput,
|
116
|
+
"name": ["DualShock 4 v1 Controller"],
|
117
|
+
"class": CONTROLLERS["Sony PLAYSTATION(R)4 Controller"]
|
118
|
+
},
|
119
|
+
{
|
120
|
+
"vidpid": "054c:09cc",
|
121
|
+
"guid": "",
|
122
|
+
"connection": ConnectionType.USB,
|
123
|
+
"input": InputType.DirectInput,
|
124
|
+
"name": ["DualShock 4 v2 Controller"],
|
125
|
+
"class": CONTROLLERS["PLAYSTATION(R)4 Controller"]
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"vidpid": "054c:09cc",
|
129
|
+
"guid": "",
|
130
|
+
"connection": ConnectionType.BLUETOOTH,
|
131
|
+
"input": InputType.DirectInput,
|
132
|
+
"name": ["DualShock 4 v2 Controller"],
|
133
|
+
"class": CONTROLLERS["Sony PLAYSTATION(R)4 Controller"]
|
134
|
+
}
|
135
|
+
],
|
136
|
+
"Microsoft Controller": [
|
137
|
+
{
|
138
|
+
"vidpid": "045e:0b12",
|
139
|
+
"guid": "0300509d5e040000120b000017050000",
|
140
|
+
"connection": ConnectionType.USB,
|
141
|
+
"input": InputType.XInput,
|
142
|
+
"name": [
|
143
|
+
"Xbox Series X Controller",
|
144
|
+
"Microsoft Corp. Xbox Controller"
|
145
|
+
],
|
146
|
+
"class": CONTROLLERS["Xbox Series X Controller"]
|
147
|
+
},
|
148
|
+
{
|
149
|
+
"vidpid": "045e:0b13",
|
150
|
+
"guid": "0500509d5e040000130b000023050000",
|
151
|
+
"connection": ConnectionType.BLUETOOTH,
|
152
|
+
"input": InputType.XInput,
|
153
|
+
"name": [
|
154
|
+
"Xbox Series X Controller",
|
155
|
+
"Xbox Wireless Controller"
|
156
|
+
],
|
157
|
+
"class": CONTROLLERS["Xbox Series X Controller"]
|
158
|
+
}
|
159
|
+
],
|
160
|
+
"Logitech Controller": [
|
161
|
+
{
|
162
|
+
"vidpid": "046d:c21d",
|
163
|
+
"guid": "030005ff6d0400001dc2000014400000",
|
164
|
+
"connection": ConnectionType.USB,
|
165
|
+
"input": InputType.XInput,
|
166
|
+
"name": [
|
167
|
+
"Logitech, Inc. F310 Gamepad [XInput Mode]",
|
168
|
+
"Logitech Gamepad F310"
|
169
|
+
],
|
170
|
+
"class": CONTROLLERS["Logitech Gamepad F310"]
|
171
|
+
},
|
172
|
+
{
|
173
|
+
"vidpid": "046d:c216",
|
174
|
+
"guid": "0300040e6d04000016c2000011010000",
|
175
|
+
"connection": ConnectionType.USB,
|
176
|
+
"input": InputType.DirectInput,
|
177
|
+
"name": [
|
178
|
+
"Logitech, Inc. F310 Gamepad [DirectInput Mode]",
|
179
|
+
"Logitech Dual Action",
|
180
|
+
"Logitech Logitech Dual Action"
|
181
|
+
],
|
182
|
+
"class": CONTROLLERS["Logitech Dual Action"]
|
183
|
+
},
|
184
|
+
{
|
185
|
+
"vidpid": "046d:c21d",
|
186
|
+
"guid": "",
|
187
|
+
"connection": ConnectionType.USB,
|
188
|
+
"input": InputType.XInput,
|
189
|
+
"name": [
|
190
|
+
"Logitech, Inc. F710 Gamepad [XInput Mode]",
|
191
|
+
"Logitech Gamepad F710"
|
192
|
+
],
|
193
|
+
"class": CONTROLLERS["Logitech Gamepad F710"]
|
194
|
+
},
|
195
|
+
{
|
196
|
+
"vidpid": "046d:c216",
|
197
|
+
"guid": "",
|
198
|
+
"connection": ConnectionType.USB,
|
199
|
+
"input": InputType.DirectInput,
|
200
|
+
"name": [
|
201
|
+
"Logitech, Inc. F710 Gamepad [DirectInput Mode]",
|
202
|
+
"Logitech Dual Action"
|
203
|
+
],
|
204
|
+
"class": CONTROLLERS["Logitech Dual Action"]
|
205
|
+
}
|
206
|
+
]
|
207
|
+
}
|
@@ -14,12 +14,8 @@ This controller is a usb controller, with the following features.
|
|
14
14
|
|
15
15
|
import pygame
|
16
16
|
from pygameControls.controlsbase import ControlsBase
|
17
|
-
from
|
17
|
+
from enums import ConnectionType
|
18
18
|
|
19
|
-
class InputMode(Enum):
|
20
|
-
DirectInput = 1
|
21
|
-
XInput = 2
|
22
|
-
|
23
19
|
class LogitechDualActionController(ControlsBase):
|
24
20
|
def __init__(self, joy):
|
25
21
|
self.device = joy
|
@@ -33,7 +29,6 @@ class LogitechDualActionController(ControlsBase):
|
|
33
29
|
self.hats: list = [self.device.get_hat(h) for h in range(self.numhats)]
|
34
30
|
self.numbuttons: int = self.device.get_numbuttons()
|
35
31
|
self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)]
|
36
|
-
self.input_mode = InputMode.DirectInput
|
37
32
|
self.mapping = {
|
38
33
|
"r2 trigger": 7,
|
39
34
|
"l2 trigger": 6,
|
@@ -85,12 +80,4 @@ class LogitechDualActionController(ControlsBase):
|
|
85
80
|
@name.setter
|
86
81
|
def name(self, name: str) -> None:
|
87
82
|
self._name = name
|
88
|
-
|
89
|
-
@property
|
90
|
-
def input_mode(self) -> int:
|
91
|
-
return self._inputmode
|
92
|
-
|
93
|
-
@input_mode.setter
|
94
|
-
def input_mode(self, mode: int) -> None:
|
95
|
-
self._inputmode = mode
|
96
83
|
|
@@ -14,12 +14,8 @@ This controller is a usb controller, with the following features.
|
|
14
14
|
|
15
15
|
import pygame
|
16
16
|
from pygameControls.controlsbase import ControlsBase
|
17
|
-
from
|
17
|
+
from enums import ConnectionType
|
18
18
|
|
19
|
-
class InputMode(Enum):
|
20
|
-
DirectInput = 1
|
21
|
-
XInput = 2
|
22
|
-
|
23
19
|
class LogitechF310Controller(ControlsBase):
|
24
20
|
def __init__(self, joy):
|
25
21
|
self.device = joy
|
@@ -33,7 +29,6 @@ class LogitechF310Controller(ControlsBase):
|
|
33
29
|
self.hats: list = [self.device.get_hat(h) for h in range(self.numhats)]
|
34
30
|
self.numbuttons: int = self.device.get_numbuttons()
|
35
31
|
self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)]
|
36
|
-
self.input_mode = InputMode.XInput
|
37
32
|
self.mapping = {
|
38
33
|
"l1 button": 4,
|
39
34
|
"r1 button": 5,
|
@@ -83,12 +78,4 @@ class LogitechF310Controller(ControlsBase):
|
|
83
78
|
@name.setter
|
84
79
|
def name(self, name: str) -> None:
|
85
80
|
self._name = name
|
86
|
-
|
87
|
-
@property
|
88
|
-
def input_mode(self) -> int:
|
89
|
-
return self._inputmode
|
90
|
-
|
91
|
-
@input_mode.setter
|
92
|
-
def input_mode(self, mode: int) -> None:
|
93
|
-
self._inputmode = mode
|
94
81
|
|
@@ -1,41 +1,26 @@
|
|
1
1
|
"""
|
2
|
-
Logitech
|
3
|
-
This controller
|
4
|
-
|
5
|
-
|
6
|
-
11 buttons
|
7
|
-
1 hat
|
8
|
-
|
9
|
-
(DirectInput mode)
|
10
|
-
4 axis
|
11
|
-
12 buttons
|
12
|
-
1 hat
|
2
|
+
Logitech F510 Controller class.
|
3
|
+
This controller should have the same setup as the F310, but with the addition of rumble effect.
|
4
|
+
I don't have this controller, so I haven't been able to verify the workings!
|
5
|
+
Subsequent updates will be done, based on updates for the F310.
|
13
6
|
"""
|
14
7
|
|
15
8
|
import pygame
|
16
9
|
from pygameControls.controlsbase import ControlsBase
|
17
|
-
from
|
18
|
-
|
19
|
-
class InputMode(Enum):
|
20
|
-
DirectInput = 1
|
21
|
-
XInput = 2
|
10
|
+
from enums import ConnectionType
|
22
11
|
|
23
|
-
class ConnectionType(Enum):
|
24
|
-
WIRED = 1
|
25
|
-
WIRELESS = 2
|
26
|
-
|
27
12
|
class LogitechF510Controller(ControlsBase):
|
28
13
|
def __init__(self, joy):
|
29
14
|
self.device = joy
|
30
15
|
self.instance_id: int = self.device.get_instance_id()
|
31
16
|
self.name = self.device.get_name()
|
17
|
+
self.guid = self.device.get_guid()
|
32
18
|
self.numaxis: int = self.device.get_numaxis()
|
33
19
|
self.axis: list = []
|
34
20
|
self.numhats: int = self.device.get_numhats()
|
35
21
|
self.hats: list = []
|
36
22
|
self.numbuttons: int = self.device.get_numbuttons()
|
37
23
|
self.buttons: list = []
|
38
|
-
self.input_mode: InputMode.DirectInput
|
39
24
|
self.mapping = {
|
40
25
|
"l1 button": 4,
|
41
26
|
"r1 button": 5,
|
@@ -109,19 +94,4 @@ class LogitechF510Controller(ControlsBase):
|
|
109
94
|
@buttons.setter
|
110
95
|
def buttons(self) -> None:
|
111
96
|
self._buttons = [self.device.get_buttons(b) for b in range(self.numbuttons)]
|
112
|
-
|
113
|
-
@property
|
114
|
-
def input_mode(self) -> int:
|
115
|
-
return self._inputmode
|
116
|
-
|
117
|
-
@input_mode.setter
|
118
|
-
def input_mode(self, mode: int) -> None:
|
119
|
-
self._inputmode = mode
|
120
|
-
|
121
|
-
@property
|
122
|
-
def input_connection(self) -> int:
|
123
|
-
return self._input_connection
|
124
|
-
|
125
|
-
@input_connection.setter
|
126
|
-
def input_connection(self, conn: int) -> None:
|
127
|
-
self._input_connection = conn
|
97
|
+
|
@@ -1,41 +1,24 @@
|
|
1
1
|
"""
|
2
|
-
Logitech
|
3
|
-
This controller is a usb controller
|
4
|
-
(XInput mode)
|
5
|
-
6 axis
|
6
|
-
11 buttons
|
7
|
-
1 hat
|
8
|
-
|
9
|
-
(DirectInput mode)
|
10
|
-
4 axis
|
11
|
-
12 buttons
|
12
|
-
1 hat
|
2
|
+
Logitech F710 Controller class.
|
3
|
+
This controller is a usb/wireless controller.
|
13
4
|
"""
|
14
5
|
|
15
6
|
import pygame
|
16
7
|
from pygameControls.controlsbase import ControlsBase
|
17
|
-
from
|
18
|
-
|
19
|
-
class InputMode(Enum):
|
20
|
-
DirectInput = 1
|
21
|
-
XInput = 2
|
8
|
+
from enums import ConnectionType
|
22
9
|
|
23
|
-
class ConnectionType(Enum):
|
24
|
-
WIRED = 1
|
25
|
-
WIRELESS = 2
|
26
|
-
|
27
10
|
class LogitechF710Controller(ControlsBase):
|
28
11
|
def __init__(self, joy):
|
29
12
|
self.device = joy
|
30
13
|
self.instance_id: int = self.device.get_instance_id()
|
31
14
|
self.name = self.device.get_name()
|
15
|
+
self.guid = self.device.get_guid()
|
32
16
|
self.numaxis: int = self.device.get_numaxis()
|
33
17
|
self.axis: list = []
|
34
18
|
self.numhats: int = self.device.get_numhats()
|
35
19
|
self.hats: list = []
|
36
20
|
self.numbuttons: int = self.device.get_numbuttons()
|
37
21
|
self.buttons: list = []
|
38
|
-
self.input_mode: InputMode.DirectInput
|
39
22
|
self.mapping = {
|
40
23
|
"l1 button": 4,
|
41
24
|
"r1 button": 5,
|
@@ -109,19 +92,4 @@ class LogitechF710Controller(ControlsBase):
|
|
109
92
|
@buttons.setter
|
110
93
|
def buttons(self) -> None:
|
111
94
|
self._buttons = [self.device.get_buttons(b) for b in range(self.numbuttons)]
|
112
|
-
|
113
|
-
@property
|
114
|
-
def input_mode(self) -> int:
|
115
|
-
return self._inputmode
|
116
|
-
|
117
|
-
@input_mode.setter
|
118
|
-
def input_mode(self, mode: int) -> None:
|
119
|
-
self._inputmode = mode
|
120
|
-
|
121
|
-
@property
|
122
|
-
def input_connection(self) -> int:
|
123
|
-
return self._input_connection
|
124
|
-
|
125
|
-
@input_connection.setter
|
126
|
-
def input_connection(self, conn: int) -> None:
|
127
|
-
self._input_connection = conn
|
95
|
+
|
@@ -1,6 +1,8 @@
|
|
1
1
|
from pygameControls.controlsbase import ControlsBase
|
2
|
+
from enums import ConnectionType
|
3
|
+
import pygame
|
2
4
|
|
3
|
-
class
|
5
|
+
class PlayStation3Controller(ControlsBase):
|
4
6
|
def __init__(self, joy):
|
5
7
|
self.device = joy
|
6
8
|
self.instance_id: int = self.device.get_instance_id()
|
@@ -0,0 +1,72 @@
|
|
1
|
+
from pygameControls.controlsbase import ControlsBase
|
2
|
+
from enums import ConnectionType
|
3
|
+
import pygame
|
4
|
+
|
5
|
+
class PlayStation4Controller(ControlsBase):
|
6
|
+
def __init__(self, joy):
|
7
|
+
self.device = joy
|
8
|
+
self.instance_id: int = self.device.get_instance_id()
|
9
|
+
self.name = self.device.get_name()
|
10
|
+
self.guid = self.device.get_guid()
|
11
|
+
self.numaxis: int = self.device.get_numaxes()
|
12
|
+
self.axis: list = [self.device.get_axis(a) for a in range(self.numaxis)]
|
13
|
+
self.numhats: int = self.device.get_numhats()
|
14
|
+
self.hats: list = [self.device.get_hat(h) for h in range(self.numhats)]
|
15
|
+
self.numbuttons: int = self.device.get_numbuttons()
|
16
|
+
self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)]
|
17
|
+
self.mapping = {
|
18
|
+
"l1 button": 4,
|
19
|
+
"r1 button": 5,
|
20
|
+
"cross button": 0,
|
21
|
+
"triangle button": 2,
|
22
|
+
"circle button": 1,
|
23
|
+
"square button": 3,
|
24
|
+
"left stick button": 11,
|
25
|
+
"right stick button": 12,
|
26
|
+
"logo button": 10,
|
27
|
+
"select button": 8,
|
28
|
+
"start button": 9,
|
29
|
+
"down button": 14,
|
30
|
+
"up button": 13,
|
31
|
+
"left button": 15,
|
32
|
+
"right button": 16
|
33
|
+
}
|
34
|
+
print(f"{self.name} connected.")
|
35
|
+
|
36
|
+
def close(self):
|
37
|
+
self.device.quit()
|
38
|
+
|
39
|
+
def handle_input(self, event):
|
40
|
+
pass
|
41
|
+
|
42
|
+
def left(self):
|
43
|
+
pass
|
44
|
+
|
45
|
+
def right(self):
|
46
|
+
pass
|
47
|
+
|
48
|
+
def up(self):
|
49
|
+
pass
|
50
|
+
|
51
|
+
def down(self):
|
52
|
+
pass
|
53
|
+
|
54
|
+
def pause(self):
|
55
|
+
pass
|
56
|
+
|
57
|
+
def rumble(self, left, right, duration=0):
|
58
|
+
if not left in range(256) or not right in range(256):
|
59
|
+
raise ValueError("left and right values must be in the range 0 - 255")
|
60
|
+
self.device.rumble(left / 255, right / 255, duration)
|
61
|
+
|
62
|
+
def stop_rumble(self):
|
63
|
+
self.device.stop_rumble()
|
64
|
+
|
65
|
+
@property
|
66
|
+
def name(self) -> str:
|
67
|
+
return self._name
|
68
|
+
|
69
|
+
@name.setter
|
70
|
+
def name(self, name: str) -> None:
|
71
|
+
self._name = name
|
72
|
+
|
@@ -0,0 +1,72 @@
|
|
1
|
+
from pygameControls.controlsbase import ControlsBase
|
2
|
+
from enums import ConnectionType
|
3
|
+
import pygame
|
4
|
+
|
5
|
+
class SonyPlayStation3Controller(ControlsBase):
|
6
|
+
def __init__(self, joy):
|
7
|
+
self.device = joy
|
8
|
+
self.instance_id: int = self.device.get_instance_id()
|
9
|
+
self.name = self.device.get_name()
|
10
|
+
self.guid = self.device.get_guid()
|
11
|
+
self.numaxis: int = self.device.get_numaxes()
|
12
|
+
self.axis: list = [self.device.get_axis(a) for a in range(self.numaxis)]
|
13
|
+
self.numhats: int = self.device.get_numhats()
|
14
|
+
self.hats: list = [self.device.get_hat(h) for h in range(self.numhats)]
|
15
|
+
self.numbuttons: int = self.device.get_numbuttons()
|
16
|
+
self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)]
|
17
|
+
self.mapping = {
|
18
|
+
"l1 button": 4,
|
19
|
+
"r1 button": 5,
|
20
|
+
"cross button": 0,
|
21
|
+
"triangle button": 2,
|
22
|
+
"circle button": 1,
|
23
|
+
"square button": 3,
|
24
|
+
"left stick button": 11,
|
25
|
+
"right stick button": 12,
|
26
|
+
"logo button": 10,
|
27
|
+
"select button": 8,
|
28
|
+
"start button": 9,
|
29
|
+
"down button": 14,
|
30
|
+
"up button": 13,
|
31
|
+
"left button": 15,
|
32
|
+
"right button": 16
|
33
|
+
}
|
34
|
+
print(f"{self.name} connected.")
|
35
|
+
|
36
|
+
def close(self):
|
37
|
+
self.device.quit()
|
38
|
+
|
39
|
+
def handle_input(self, event):
|
40
|
+
pass
|
41
|
+
|
42
|
+
def left(self):
|
43
|
+
pass
|
44
|
+
|
45
|
+
def right(self):
|
46
|
+
pass
|
47
|
+
|
48
|
+
def up(self):
|
49
|
+
pass
|
50
|
+
|
51
|
+
def down(self):
|
52
|
+
pass
|
53
|
+
|
54
|
+
def pause(self):
|
55
|
+
pass
|
56
|
+
|
57
|
+
def rumble(self, left, right, duration=0):
|
58
|
+
if not left in range(256) or not right in range(256):
|
59
|
+
raise ValueError("left and right values must be in the range 0 - 255")
|
60
|
+
self.device.rumble(left / 255, right / 255, duration)
|
61
|
+
|
62
|
+
def stop_rumble(self):
|
63
|
+
self.device.stop_rumble()
|
64
|
+
|
65
|
+
@property
|
66
|
+
def name(self) -> str:
|
67
|
+
return self._name
|
68
|
+
|
69
|
+
@name.setter
|
70
|
+
def name(self, name: str) -> None:
|
71
|
+
self._name = name
|
72
|
+
|
@@ -0,0 +1,72 @@
|
|
1
|
+
from pygameControls.controlsbase import ControlsBase
|
2
|
+
from enums import ConnectionType
|
3
|
+
import pygame
|
4
|
+
|
5
|
+
class SonyPlayStation4Controller(ControlsBase):
|
6
|
+
def __init__(self, joy):
|
7
|
+
self.device = joy
|
8
|
+
self.instance_id: int = self.device.get_instance_id()
|
9
|
+
self.name = self.device.get_name()
|
10
|
+
self.guid = self.device.get_guid()
|
11
|
+
self.numaxis: int = self.device.get_numaxes()
|
12
|
+
self.axis: list = [self.device.get_axis(a) for a in range(self.numaxis)]
|
13
|
+
self.numhats: int = self.device.get_numhats()
|
14
|
+
self.hats: list = [self.device.get_hat(h) for h in range(self.numhats)]
|
15
|
+
self.numbuttons: int = self.device.get_numbuttons()
|
16
|
+
self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)]
|
17
|
+
self.mapping = {
|
18
|
+
"l1 button": 4,
|
19
|
+
"r1 button": 5,
|
20
|
+
"cross button": 0,
|
21
|
+
"triangle button": 2,
|
22
|
+
"circle button": 1,
|
23
|
+
"square button": 3,
|
24
|
+
"left stick button": 11,
|
25
|
+
"right stick button": 12,
|
26
|
+
"logo button": 10,
|
27
|
+
"select button": 8,
|
28
|
+
"start button": 9,
|
29
|
+
"down button": 14,
|
30
|
+
"up button": 13,
|
31
|
+
"left button": 15,
|
32
|
+
"right button": 16
|
33
|
+
}
|
34
|
+
print(f"{self.name} connected.")
|
35
|
+
|
36
|
+
def close(self):
|
37
|
+
self.device.quit()
|
38
|
+
|
39
|
+
def handle_input(self, event):
|
40
|
+
pass
|
41
|
+
|
42
|
+
def left(self):
|
43
|
+
pass
|
44
|
+
|
45
|
+
def right(self):
|
46
|
+
pass
|
47
|
+
|
48
|
+
def up(self):
|
49
|
+
pass
|
50
|
+
|
51
|
+
def down(self):
|
52
|
+
pass
|
53
|
+
|
54
|
+
def pause(self):
|
55
|
+
pass
|
56
|
+
|
57
|
+
def rumble(self, left, right, duration=0):
|
58
|
+
if not left in range(256) or not right in range(256):
|
59
|
+
raise ValueError("left and right values must be in the range 0 - 255")
|
60
|
+
self.device.rumble(left / 255, right / 255, duration)
|
61
|
+
|
62
|
+
def stop_rumble(self):
|
63
|
+
self.device.stop_rumble()
|
64
|
+
|
65
|
+
@property
|
66
|
+
def name(self) -> str:
|
67
|
+
return self._name
|
68
|
+
|
69
|
+
@name.setter
|
70
|
+
def name(self, name: str) -> None:
|
71
|
+
self._name = name
|
72
|
+
|
@@ -0,0 +1,69 @@
|
|
1
|
+
from pygameControls.controlsbase import ControlsBase
|
2
|
+
from enums import ConnectionType, InputType
|
3
|
+
import pygame
|
4
|
+
|
5
|
+
class Xbox360Controller(ControlsBase):
|
6
|
+
def __init__(self, joy):
|
7
|
+
self.device = joy
|
8
|
+
self.instance_id: int = self.device.get_instance_id()
|
9
|
+
self.name = self.device.get_name()
|
10
|
+
self.guid = self.device.get_guid()
|
11
|
+
self.numaxis: int = self.device.get_numaxes()
|
12
|
+
self.axis: list = [self.device.get_axis(a) for a in range(self.numaxis)]
|
13
|
+
self.numhats: int = self.device.get_numhats()
|
14
|
+
self.hats: list = [self.device.get_hat(h) for h in range(self.numhats)]
|
15
|
+
self.numbuttons: int = self.device.get_numbuttons()
|
16
|
+
self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)]
|
17
|
+
self.mapping = {
|
18
|
+
"l1 button": 6,
|
19
|
+
"r1 button": 7,
|
20
|
+
"X button": 3,
|
21
|
+
"Y button": 4,
|
22
|
+
"A button": 0,
|
23
|
+
"B button": 1,
|
24
|
+
"left stick button": 13,
|
25
|
+
"right stick button": 14,
|
26
|
+
"logo button": 12,
|
27
|
+
"share button": 15,
|
28
|
+
"list button": 11,
|
29
|
+
"copy button": 10
|
30
|
+
}
|
31
|
+
print(f"{self.name} connected.")
|
32
|
+
|
33
|
+
def close(self):
|
34
|
+
self.device.quit()
|
35
|
+
|
36
|
+
def handle_input(self, event):
|
37
|
+
pass
|
38
|
+
|
39
|
+
def left(self):
|
40
|
+
pass
|
41
|
+
|
42
|
+
def right(self):
|
43
|
+
pass
|
44
|
+
|
45
|
+
def up(self):
|
46
|
+
pass
|
47
|
+
|
48
|
+
def down(self):
|
49
|
+
pass
|
50
|
+
|
51
|
+
def pause(self):
|
52
|
+
pass
|
53
|
+
|
54
|
+
def rumble(self, left, right, duration=0):
|
55
|
+
if not left in range(256) or not right in range(256):
|
56
|
+
raise ValueError("left and right values must be in the range 0 - 255")
|
57
|
+
self.device.rumble(left / 255, right / 255, duration)
|
58
|
+
|
59
|
+
def stop_rumble(self):
|
60
|
+
self.device.stop_rumble()
|
61
|
+
|
62
|
+
@property
|
63
|
+
def name(self) -> str:
|
64
|
+
return self._name
|
65
|
+
|
66
|
+
@name.setter
|
67
|
+
def name(self, name: str) -> None:
|
68
|
+
self._name = name
|
69
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
pygameControls/__init__.py,sha256=Ivl6jPIP4xfrBe5kokd2FXP_CLV0bATuV3rorKfDcHI,25
|
2
|
+
pygameControls/controller.py,sha256=jt823gYd0CiJe3m0HCF5lIpNkzuY4dAuQStHRfkC8aM,578
|
3
|
+
pygameControls/controlsbase.py,sha256=2o4gxsbP50IesYv9dye_RKA_2gzStVSH5G0BG5hgnG8,668
|
4
|
+
pygameControls/dualsense_controller.py,sha256=sh5QI-DSSWGTeKw532w-Jl-OPkuEB0iFaZ9BZOLuBR8,3032
|
5
|
+
pygameControls/dualsense_edge_controller.py,sha256=dfleVIfyer3ygV1ERygFzwW5KS7rzJi5EwRBcbshPtA,3361
|
6
|
+
pygameControls/enums.py,sha256=r9xsepu6IBxBCABxtaGFP4Nh9zdA3yIcZnCJq0o3bEQ,190
|
7
|
+
pygameControls/generic_controller.py,sha256=g-szD-25dyyHMJQ9pBiqxcbi1DcpnNo87sSiNBv1Fzo,1769
|
8
|
+
pygameControls/globals.py,sha256=NsgEHsDgKbJzkkzuM72nEzpgQubmTk3JNyZnPMwkTmo,8583
|
9
|
+
pygameControls/logitech_dual_action_controller.py,sha256=h9rElBE_7XF7grp5bMdrH2HdQT6o3JjliOu7wL8-fhk,2017
|
10
|
+
pygameControls/logitech_f310_controller.py,sha256=rtryKrAvnYvmHX1tEhpv3OvzggR1vbWW2A6uE08l0RY,1949
|
11
|
+
pygameControls/logitech_f510_controller.py,sha256=2ljRSGjNXbWDgTiJRJgdhT8uXdgl3TQR0fhvJbwIMkU,2439
|
12
|
+
pygameControls/logitech_f710_controller.py,sha256=HfI5qoi7DyaxPgj7DamYmiAijl73uSDNItlw99TmUmY,2248
|
13
|
+
pygameControls/playstation3_controller.py,sha256=vExXCKf_ZnzesvwureupLPdEsp8xMV_J5A_UXjKXRF0,2110
|
14
|
+
pygameControls/playstation4_controller.py,sha256=FURi3-iG7RjwHvQ3UCqtqCG16lhaxtnnOybeBoeKhj0,2110
|
15
|
+
pygameControls/sony_playstation3_controller.py,sha256=2wcJjoeZwGm43HVTphrYVp_jTtsmnZ51hOb7OXrd_Ks,2114
|
16
|
+
pygameControls/sony_playstation4_controller.py,sha256=d5y6Kfbju4iX6qb0MHlVXxSMFO6SASDtmM0baxhanro,2114
|
17
|
+
pygameControls/xbox_360_controller.py,sha256=nMA5ZQ5HYvycR11lm-jChqzWW9OxyCvdQcOb4lpKVI0,2003
|
18
|
+
pygameControls/xbox_series_x_controller.py,sha256=NYQG3XeunN2BnR5BVnvrddQXykdmy0dTJ1LBlW1B7gk,1996
|
19
|
+
pygamecontrols-0.2.0.dist-info/licenses/LICENSE,sha256=KQMYrAM921Oeawv1XkqKG3PxDJy9v7wuu1vhr63d2CY,1070
|
20
|
+
pygamecontrols-0.2.0.dist-info/METADATA,sha256=IAhDarrcLRp_39fOv2IlnWs5lBaF6eKPnURIx8pVhWI,617
|
21
|
+
pygamecontrols-0.2.0.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
22
|
+
pygamecontrols-0.2.0.dist-info/top_level.txt,sha256=Tg86INulVO2XDGUPiQCC68Zsl36kBlr0My-Bn-q04V8,15
|
23
|
+
pygamecontrols-0.2.0.dist-info/RECORD,,
|
@@ -1,17 +0,0 @@
|
|
1
|
-
pygameControls/__init__.py,sha256=Ivl6jPIP4xfrBe5kokd2FXP_CLV0bATuV3rorKfDcHI,25
|
2
|
-
pygameControls/controller.py,sha256=-PctF8dmSfXkjOtRztQRfdULoNL3W6Y5qT0avjlRDxk,1369
|
3
|
-
pygameControls/controlsbase.py,sha256=2o4gxsbP50IesYv9dye_RKA_2gzStVSH5G0BG5hgnG8,668
|
4
|
-
pygameControls/dualsense_controller.py,sha256=KYMsh95ANr_LhrFnEit5UjNnae8pNr8rMQb_ON66TDE,2955
|
5
|
-
pygameControls/dualsense_edge_controller.py,sha256=zV09j3BHffSHsRXI--DH4Cc-h65mBquuAM1NQtQlyhU,3285
|
6
|
-
pygameControls/dualshock3_controller.py,sha256=F3waO_04GeDUj8ZlE1fM3IUW2b3F-g7Y2rRMt0JkDRw,2061
|
7
|
-
pygameControls/generic_controller.py,sha256=ISgcrX1fMr1g0FTeqzsIpOlmpTr5RG_wmNgnzcu7UII,1736
|
8
|
-
pygameControls/logitech_dual_action_controller.py,sha256=LgtlxOfh4lDGaoMolTfe-0E2jWigeOPi0g1O1VBjZyc,2304
|
9
|
-
pygameControls/logitech_f310_controller.py,sha256=VaPphCboQBralhDWlVBnHkJTBF5beQrCeHgGJN6s8jc,2231
|
10
|
-
pygameControls/logitech_f510_controller.py,sha256=_sNxElAQ8MX_A8xuFCB3phdkgV7GmFAPQhw03KAFiPo,2867
|
11
|
-
pygameControls/logitech_f710_controller.py,sha256=VTyAPagPyWHp7QzMETDJ0aM2FjAZx_V5H4p2vvtD_yg,2867
|
12
|
-
pygameControls/xbox_series_x_controller.py,sha256=NPTUMeFhOKXF4-xHmk5hsMxyMmBNEHjF1KJDCBJnC1Q,1949
|
13
|
-
pygamecontrols-0.1.12.dist-info/licenses/LICENSE,sha256=KQMYrAM921Oeawv1XkqKG3PxDJy9v7wuu1vhr63d2CY,1070
|
14
|
-
pygamecontrols-0.1.12.dist-info/METADATA,sha256=Zc9sN19FIK77S7MH6t3Uep4fbcrp6ydQPGvp21O2RdI,618
|
15
|
-
pygamecontrols-0.1.12.dist-info/WHEEL,sha256=GHB6lJx2juba1wDgXDNlMTyM13ckjBMKf-OnwgKOCtA,91
|
16
|
-
pygamecontrols-0.1.12.dist-info/top_level.txt,sha256=Tg86INulVO2XDGUPiQCC68Zsl36kBlr0My-Bn-q04V8,15
|
17
|
-
pygamecontrols-0.1.12.dist-info/RECORD,,
|
File without changes
|
File without changes
|