pygameControls 0.1.11__py3-none-any.whl → 0.1.13__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.
@@ -6,10 +6,12 @@ from .logitech_f310_controller import LogitechF310Controller
6
6
  from .logitech_f510_controller import LogitechF510Controller
7
7
  from .logitech_f710_controller import LogitechF710Controller
8
8
  from .xbox_series_x_controller import XboxSeriesXController
9
+ from .sony_playstation3_controller import SonyPlayStation3Controller
10
+ from .playstation3_controller import PlayStation3Controller
9
11
  from .generic_controller import GenericController
10
12
  from .logitech_dual_action_controller import LogitechDualActionController
11
13
 
12
- __version__ = "0.1.11"
14
+ __version__ = "0.1.13"
13
15
 
14
16
  CONTROLLERS = {
15
17
  "DualSense Wireless Controller": DualSenseController,
@@ -18,7 +20,9 @@ CONTROLLERS = {
18
20
  "Logitech Gamepad F510": LogitechF510Controller,
19
21
  "Logitech Gamepad F710": LogitechF710Controller,
20
22
  "Logitech Dual Action": LogitechDualActionController,
21
- "Xbox Series X Controller": XboxSeriesXController
23
+ "Xbox Series X Controller": XboxSeriesXController,
24
+ "Sony PLAYSTATION(R)3 Controller": SonyPlayStation3Controller,
25
+ "PLAYSTATION(R)3 Controller": PlayStation3Controller
22
26
  }
23
27
 
24
28
  class Controllers:
@@ -0,0 +1,70 @@
1
+ from pygameControls.controlsbase import ControlsBase
2
+
3
+ class PlayStation3Controller(ControlsBase):
4
+ def __init__(self, joy):
5
+ self.device = joy
6
+ self.instance_id: int = self.device.get_instance_id()
7
+ self.name = self.device.get_name()
8
+ self.guid = self.device.get_guid()
9
+ self.numaxis: int = self.device.get_numaxes()
10
+ self.axis: list = [self.device.get_axis(a) for a in range(self.numaxis)]
11
+ self.numhats: int = self.device.get_numhats()
12
+ self.hats: list = [self.device.get_hat(h) for h in range(self.numhats)]
13
+ self.numbuttons: int = self.device.get_numbuttons()
14
+ self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)]
15
+ self.mapping = {
16
+ "l1 button": 4,
17
+ "r1 button": 5,
18
+ "cross button": 0,
19
+ "triangle button": 2,
20
+ "circle button": 1,
21
+ "square button": 3,
22
+ "left stick button": 11,
23
+ "right stick button": 12,
24
+ "logo button": 10,
25
+ "select button": 8,
26
+ "start button": 9,
27
+ "down button": 14,
28
+ "up button": 13,
29
+ "left button": 15,
30
+ "right button": 16
31
+ }
32
+ print(f"{self.name} connected.")
33
+
34
+ def close(self):
35
+ self.device.quit()
36
+
37
+ def handle_input(self, event):
38
+ pass
39
+
40
+ def left(self):
41
+ pass
42
+
43
+ def right(self):
44
+ pass
45
+
46
+ def up(self):
47
+ pass
48
+
49
+ def down(self):
50
+ pass
51
+
52
+ def pause(self):
53
+ pass
54
+
55
+ def rumble(self, left, right, duration=0):
56
+ if not left in range(256) or not right in range(256):
57
+ raise ValueError("left and right values must be in the range 0 - 255")
58
+ self.device.rumble(left / 255, right / 255, duration)
59
+
60
+ def stop_rumble(self):
61
+ self.device.stop_rumble()
62
+
63
+ @property
64
+ def name(self) -> str:
65
+ return self._name
66
+
67
+ @name.setter
68
+ def name(self, name: str) -> None:
69
+ self._name = name
70
+
@@ -0,0 +1,70 @@
1
+ from pygameControls.controlsbase import ControlsBase
2
+
3
+ class SonyPlayStation3Controller(ControlsBase):
4
+ def __init__(self, joy):
5
+ self.device = joy
6
+ self.instance_id: int = self.device.get_instance_id()
7
+ self.name = self.device.get_name()
8
+ self.guid = self.device.get_guid()
9
+ self.numaxis: int = self.device.get_numaxes()
10
+ self.axis: list = [self.device.get_axis(a) for a in range(self.numaxis)]
11
+ self.numhats: int = self.device.get_numhats()
12
+ self.hats: list = [self.device.get_hat(h) for h in range(self.numhats)]
13
+ self.numbuttons: int = self.device.get_numbuttons()
14
+ self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)]
15
+ self.mapping = {
16
+ "l1 button": 4,
17
+ "r1 button": 5,
18
+ "cross button": 0,
19
+ "triangle button": 2,
20
+ "circle button": 1,
21
+ "square button": 3,
22
+ "left stick button": 11,
23
+ "right stick button": 12,
24
+ "logo button": 10,
25
+ "select button": 8,
26
+ "start button": 9,
27
+ "down button": 14,
28
+ "up button": 13,
29
+ "left button": 15,
30
+ "right button": 16
31
+ }
32
+ print(f"{self.name} connected.")
33
+
34
+ def close(self):
35
+ self.device.quit()
36
+
37
+ def handle_input(self, event):
38
+ pass
39
+
40
+ def left(self):
41
+ pass
42
+
43
+ def right(self):
44
+ pass
45
+
46
+ def up(self):
47
+ pass
48
+
49
+ def down(self):
50
+ pass
51
+
52
+ def pause(self):
53
+ pass
54
+
55
+ def rumble(self, left, right, duration=0):
56
+ if not left in range(256) or not right in range(256):
57
+ raise ValueError("left and right values must be in the range 0 - 255")
58
+ self.device.rumble(left / 255, right / 255, duration)
59
+
60
+ def stop_rumble(self):
61
+ self.device.stop_rumble()
62
+
63
+ @property
64
+ def name(self) -> str:
65
+ return self._name
66
+
67
+ @name.setter
68
+ def name(self, name: str) -> None:
69
+ self._name = name
70
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygameControls
3
- Version: 0.1.11
3
+ Version: 0.1.13
4
4
  Summary: A simple controller class for pygame.
5
5
  Home-page:
6
6
  Author: Jan Lerking
@@ -1,5 +1,5 @@
1
1
  pygameControls/__init__.py,sha256=Ivl6jPIP4xfrBe5kokd2FXP_CLV0bATuV3rorKfDcHI,25
2
- pygameControls/controller.py,sha256=gM0bm0h2WKrhCyFRrDfc8ppWVrmvkoflLq7KZu4Mk3g,1257
2
+ pygameControls/controller.py,sha256=PNbpS77LXuPNF3BbXl8rUj5zEwYLqCIuvABKKLIUff0,1511
3
3
  pygameControls/controlsbase.py,sha256=2o4gxsbP50IesYv9dye_RKA_2gzStVSH5G0BG5hgnG8,668
4
4
  pygameControls/dualsense_controller.py,sha256=KYMsh95ANr_LhrFnEit5UjNnae8pNr8rMQb_ON66TDE,2955
5
5
  pygameControls/dualsense_edge_controller.py,sha256=zV09j3BHffSHsRXI--DH4Cc-h65mBquuAM1NQtQlyhU,3285
@@ -8,9 +8,11 @@ pygameControls/logitech_dual_action_controller.py,sha256=LgtlxOfh4lDGaoMolTfe-0E
8
8
  pygameControls/logitech_f310_controller.py,sha256=VaPphCboQBralhDWlVBnHkJTBF5beQrCeHgGJN6s8jc,2231
9
9
  pygameControls/logitech_f510_controller.py,sha256=_sNxElAQ8MX_A8xuFCB3phdkgV7GmFAPQhw03KAFiPo,2867
10
10
  pygameControls/logitech_f710_controller.py,sha256=VTyAPagPyWHp7QzMETDJ0aM2FjAZx_V5H4p2vvtD_yg,2867
11
+ pygameControls/playstation3_controller.py,sha256=SzoV3rMJy_mcOEDuU4fMeU0aKYKeqDV1Tl99eT3eBIo,2063
12
+ pygameControls/sony_playstation3_controller.py,sha256=DOb0MKrHKBS-0A-aNjVtBCdZsfS9t0PUbr9kpaUdj-Q,2067
11
13
  pygameControls/xbox_series_x_controller.py,sha256=NPTUMeFhOKXF4-xHmk5hsMxyMmBNEHjF1KJDCBJnC1Q,1949
12
- pygamecontrols-0.1.11.dist-info/licenses/LICENSE,sha256=KQMYrAM921Oeawv1XkqKG3PxDJy9v7wuu1vhr63d2CY,1070
13
- pygamecontrols-0.1.11.dist-info/METADATA,sha256=qpuwNH_Oc0K8c1EkthEWiJRov_uM6DGjYoWf5FcWpVk,618
14
- pygamecontrols-0.1.11.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
15
- pygamecontrols-0.1.11.dist-info/top_level.txt,sha256=Tg86INulVO2XDGUPiQCC68Zsl36kBlr0My-Bn-q04V8,15
16
- pygamecontrols-0.1.11.dist-info/RECORD,,
14
+ pygamecontrols-0.1.13.dist-info/licenses/LICENSE,sha256=KQMYrAM921Oeawv1XkqKG3PxDJy9v7wuu1vhr63d2CY,1070
15
+ pygamecontrols-0.1.13.dist-info/METADATA,sha256=AqKEEUhOvyhMMmvCCbflwE4O1IO26peTKJWJcGKeirE,618
16
+ pygamecontrols-0.1.13.dist-info/WHEEL,sha256=GHB6lJx2juba1wDgXDNlMTyM13ckjBMKf-OnwgKOCtA,91
17
+ pygamecontrols-0.1.13.dist-info/top_level.txt,sha256=Tg86INulVO2XDGUPiQCC68Zsl36kBlr0My-Bn-q04V8,15
18
+ pygamecontrols-0.1.13.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (79.0.1)
2
+ Generator: setuptools (80.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5