pygameControls 0.1.10__py3-none-any.whl → 0.1.12__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,11 @@ 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 .dualshock3_controller import DualShock3Controller
9
10
  from .generic_controller import GenericController
10
11
  from .logitech_dual_action_controller import LogitechDualActionController
11
12
 
12
- __version__ = "0.1.10"
13
+ __version__ = "0.1.12"
13
14
 
14
15
  CONTROLLERS = {
15
16
  "DualSense Wireless Controller": DualSenseController,
@@ -18,7 +19,8 @@ CONTROLLERS = {
18
19
  "Logitech Gamepad F510": LogitechF510Controller,
19
20
  "Logitech Gamepad F710": LogitechF710Controller,
20
21
  "Logitech Dual Action": LogitechDualActionController,
21
- "Xbox Series X Controller": XboxSeriesXController
22
+ "Xbox Series X Controller": XboxSeriesXController,
23
+ "PLAYSTATION(R)3 Controller": DualShock3Controller
22
24
  }
23
25
 
24
26
  class Controllers:
@@ -25,25 +25,17 @@ class DualSenseController(ControlsBase):
25
25
  self.numbuttons: int = joy.get_numbuttons()
26
26
  self.buttons: list = [joy.get_button(b) for b in range(self.numbuttons)]
27
27
  self.mapping = {
28
- "left stick x": self.axis[0],
29
- "left stick y": self.axis[1],
30
- "right stick x": self.axis[3],
31
- "right stick y": self.axis[4],
32
- "right trigger": self.buttons[5],
33
- "left trigger": self.buttons[2],
34
- "dhat x": self.hats[0][0],
35
- "dhat y": self.hats[0][1],
36
- "left button": self.buttons[4],
37
- "right button": self.buttons[5],
38
- "cross button": self.buttons[0],
39
- "triangle button": self.buttons[2],
40
- "circle button": self.buttons[1],
41
- "square button": self.buttons[3],
42
- "left stick button": self.buttons[11],
43
- "right stick button": self.buttons[12],
44
- "connect button": self.buttons[8],
45
- "list button": self.buttons[9],
46
- "logo button": self.buttons[10]
28
+ "l1 button": 4,
29
+ "r1 button": 5,
30
+ "cross button": 0,
31
+ "triangle button": 2,
32
+ "circle button": 1,
33
+ "square button": 3,
34
+ "left stick button": 11,
35
+ "right stick button": 12,
36
+ "connect button": 8,
37
+ "list button": 9,
38
+ "logo button": 10
47
39
  }
48
40
  print(f"{self.name} connected")
49
41
  print(f"Power level: {self.powerlevel}")
@@ -0,0 +1,70 @@
1
+ from pygameControls.controlsbase import ControlsBase
2
+
3
+ class DualShock3Controller(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
+
@@ -14,24 +14,18 @@ class GenericController(ControlsBase):
14
14
  self.numbuttons: int = self.device.get_numbuttons()
15
15
  self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)]
16
16
  self.mapping = {
17
- "left stick x": self.axis[0],
18
- "left stick y": self.axis[1],
19
- "right stick x": self.axis[2],
20
- "right stick y": self.axis[3],
21
- "right trigger": self.buttons[7],
22
- "left trigger": self.buttons[6],
23
- "dhat x": self.hats[0][0],
24
- "dhat y": self.hats[0][1],
25
- "left button": self.buttons[4],
26
- "right button": self.buttons[5],
27
- "X button": self.buttons[0],
28
- "Y button": self.buttons[3],
29
- "A button": self.buttons[1],
30
- "B button": self.buttons[2],
31
- "left stick button": self.buttons[10],
32
- "right stick button": self.buttons[11],
33
- "back button": self.buttons[8],
34
- "start button": self.buttons[9],
17
+ "r2 trigger": 7,
18
+ "l2 trigger": 6,
19
+ "l1 button": 4,
20
+ "r1 button": 5,
21
+ "X button": 0,
22
+ "Y button": 3,
23
+ "A button": 1,
24
+ "B button": 2,
25
+ "left stick button": 10,
26
+ "right stick button": 11,
27
+ "back button": 8,
28
+ "start button": 9,
35
29
  "logo button": None
36
30
  }
37
31
  print(f"{self.name} connected.")
@@ -35,24 +35,18 @@ class LogitechDualActionController(ControlsBase):
35
35
  self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)]
36
36
  self.input_mode = InputMode.DirectInput
37
37
  self.mapping = {
38
- "left stick x": self.axis[0],
39
- "left stick y": self.axis[1],
40
- "right stick x": self.axis[2],
41
- "right stick y": self.axis[3],
42
- "right trigger": self.buttons[7],
43
- "left trigger": self.buttons[6],
44
- "dhat x": self.hats[0][0],
45
- "dhat y": self.hats[0][1],
46
- "left button": self.buttons[4],
47
- "right button": self.buttons[5],
48
- "X button": self.buttons[0],
49
- "Y button": self.buttons[3],
50
- "A button": self.buttons[1],
51
- "B button": self.buttons[2],
52
- "left stick button": self.buttons[10],
53
- "right stick button": self.buttons[11],
54
- "back button": self.buttons[8],
55
- "start button": self.buttons[9],
38
+ "r2 trigger": 7,
39
+ "l2 trigger": 6,
40
+ "l1 button": 4,
41
+ "r1 button": 5,
42
+ "X button": 0,
43
+ "Y button": 3,
44
+ "A button": 1,
45
+ "B button": 2,
46
+ "left stick button": 10,
47
+ "right stick button": 11,
48
+ "back button": 8,
49
+ "start button": 9,
56
50
  "logo button": None
57
51
  }
58
52
  print(f"{self.name} connected.")
@@ -35,25 +35,17 @@ class LogitechF310Controller(ControlsBase):
35
35
  self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)]
36
36
  self.input_mode = InputMode.XInput
37
37
  self.mapping = {
38
- "left stick x": self.axis[0],
39
- "left stick y": self.axis[1],
40
- "right stick x": self.axis[3],
41
- "right stick y": self.axis[4],
42
- "right trigger": self.axis[2],
43
- "left trigger": self.axis[5],
44
- "dhat x": self.hats[0][0],
45
- "dhat y": self.hats[0][1],
46
- "left button": self.buttons[4],
47
- "right button": self.buttons[5],
48
- "X button": self.buttons[2],
49
- "Y button": self.buttons[3],
50
- "A button": self.buttons[0],
51
- "B button": self.buttons[1],
52
- "left stick button": self.buttons[9],
53
- "right stick button": self.buttons[10],
54
- "back button": self.buttons[6],
55
- "start button": self.buttons[7],
56
- "logo button": self.buttons[8]
38
+ "l1 button": 4,
39
+ "r1 button": 5,
40
+ "X button": 2,
41
+ "Y button": 3,
42
+ "A button": 0,
43
+ "B button": 1,
44
+ "left stick button": 9,
45
+ "right stick button": 10,
46
+ "back button": 6,
47
+ "start button": 7,
48
+ "logo button": 8
57
49
  }
58
50
  print(f"{self.name} connected.")
59
51
 
@@ -37,25 +37,17 @@ class LogitechF510Controller(ControlsBase):
37
37
  self.buttons: list = []
38
38
  self.input_mode: InputMode.DirectInput
39
39
  self.mapping = {
40
- "left stick x": self.axis[0],
41
- "left stick y": self.axis[1],
42
- "right stick x": self.axis[3],
43
- "right stick y": self.axis[4],
44
- "right trigger": self.axis[2],
45
- "left trigger": self.axis[5],
46
- "dhat x": self.hats[0][0],
47
- "dhat y": self.hats[0][1],
48
- "left button": self.buttons[4],
49
- "right button": self.buttons[5],
50
- "X button": self.buttons[2],
51
- "Y button": self.buttons[3],
52
- "A button": self.buttons[0],
53
- "B button": self.buttons[1],
54
- "left stick button": self.buttons[9],
55
- "right stick button": self.buttons[10],
56
- "back button": self.buttons[6],
57
- "start button": self.buttons[7],
58
- "logo button": self.buttons[8]
40
+ "l1 button": 4,
41
+ "r1 button": 5,
42
+ "X button": 2,
43
+ "Y button": 3,
44
+ "A button": 0,
45
+ "B button": 1,
46
+ "left stick button": 9,
47
+ "right stick button": 10,
48
+ "back button": 6,
49
+ "start button": 7,
50
+ "logo button": 8
59
51
  }
60
52
  print(f"{self.name} connected.")
61
53
 
@@ -37,25 +37,17 @@ class LogitechF710Controller(ControlsBase):
37
37
  self.buttons: list = []
38
38
  self.input_mode: InputMode.DirectInput
39
39
  self.mapping = {
40
- "left stick x": self.axis[0],
41
- "left stick y": self.axis[1],
42
- "right stick x": self.axis[3],
43
- "right stick y": self.axis[4],
44
- "right trigger": self.axis[2],
45
- "left trigger": self.axis[5],
46
- "dhat x": self.hats[0][0],
47
- "dhat y": self.hats[0][1],
48
- "left button": self.buttons[4],
49
- "right button": self.buttons[5],
50
- "X button": self.buttons[2],
51
- "Y button": self.buttons[3],
52
- "A button": self.buttons[0],
53
- "B button": self.buttons[1],
54
- "left stick button": self.buttons[9],
55
- "right stick button": self.buttons[10],
56
- "back button": self.buttons[6],
57
- "start button": self.buttons[7],
58
- "logo button": self.buttons[8]
40
+ "l1 button": 4,
41
+ "r1 button": 5,
42
+ "X button": 2,
43
+ "Y button": 3,
44
+ "A button": 0,
45
+ "B button": 1,
46
+ "left stick button": 9,
47
+ "right stick button": 10,
48
+ "back button": 6,
49
+ "start button": 7,
50
+ "logo button": 8
59
51
  }
60
52
  print(f"{self.name} connected.")
61
53
 
@@ -13,26 +13,18 @@ class XboxSeriesXController(ControlsBase):
13
13
  self.numbuttons: int = self.device.get_numbuttons()
14
14
  self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)]
15
15
  self.mapping = {
16
- "left stick x": self.axis[0],
17
- "left stick y": self.axis[1],
18
- "right stick x": self.axis[2],
19
- "right stick y": self.axis[3],
20
- "right trigger": self.axis[4],
21
- "left trigger": self.axis[5],
22
- "dhat x": self.hats[0][0],
23
- "dhat y": self.hats[0][1],
24
- "left button": self.buttons[6],
25
- "right button": self.buttons[7],
26
- "X button": self.buttons[3],
16
+ "l1 button": 6,
17
+ "r1 button": 7,
18
+ "X button": 3,
27
19
  "Y button": 4,
28
20
  "A button": 0,
29
- "B button": self.buttons[1],
30
- "left stick button": self.buttons[13],
31
- "right stick button": self.buttons[14],
32
- "logo button": self.buttons[12],
33
- "share button": self.buttons[15],
34
- "list button": self.buttons[11],
35
- "copy button": self.buttons[10]
21
+ "B button": 1,
22
+ "left stick button": 13,
23
+ "right stick button": 14,
24
+ "logo button": 12,
25
+ "share button": 15,
26
+ "list button": 11,
27
+ "copy button": 10
36
28
  }
37
29
  print(f"{self.name} connected.")
38
30
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygameControls
3
- Version: 0.1.10
3
+ Version: 0.1.12
4
4
  Summary: A simple controller class for pygame.
5
5
  Home-page:
6
6
  Author: Jan Lerking
@@ -0,0 +1,17 @@
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,,
@@ -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
 
@@ -1,16 +0,0 @@
1
- pygameControls/__init__.py,sha256=Ivl6jPIP4xfrBe5kokd2FXP_CLV0bATuV3rorKfDcHI,25
2
- pygameControls/controller.py,sha256=utpJ7zliMMggySpesUT0mgMfy2S0gAs6GKt5bDMc8G8,1257
3
- pygameControls/controlsbase.py,sha256=2o4gxsbP50IesYv9dye_RKA_2gzStVSH5G0BG5hgnG8,668
4
- pygameControls/dualsense_controller.py,sha256=Q8zPrkXHp2FCvMof1RFEeHGhhiYbwkEU7WoFSmPfO3c,3453
5
- pygameControls/dualsense_edge_controller.py,sha256=zV09j3BHffSHsRXI--DH4Cc-h65mBquuAM1NQtQlyhU,3285
6
- pygameControls/generic_controller.py,sha256=fKMc_ibvm4HeVQwL3xs1SIB2ww0K1XrVlbLNguKC0Co,2162
7
- pygameControls/logitech_dual_action_controller.py,sha256=zjuNi6rBJNXlflKsEFUjkMOjVp2vd4MKFFzMp6wB75Q,2730
8
- pygameControls/logitech_f310_controller.py,sha256=gH9ZvAuqpfQXmoDPs3gmkUtE3CLHfgQnwFG_b8VNl5w,2723
9
- pygameControls/logitech_f510_controller.py,sha256=hiF0unxAcV5FlomUnpCmbZEMWn9DN76jO49TWUsxW7c,3359
10
- pygameControls/logitech_f710_controller.py,sha256=8lEA95i__M2i7q1_h-JgT6B-hbu5lXbiXRu7O4I_VE8,3359
11
- pygameControls/xbox_series_x_controller.py,sha256=KX2h9KdFA1YbZ_2V05IDcjIyVH8719MFXRc8GnKbxdo,2427
12
- pygamecontrols-0.1.10.dist-info/licenses/LICENSE,sha256=KQMYrAM921Oeawv1XkqKG3PxDJy9v7wuu1vhr63d2CY,1070
13
- pygamecontrols-0.1.10.dist-info/METADATA,sha256=zuJDRvwml-f1_Q_MUrEzThIl_NMz7B2ZQhP8nnmZv4g,618
14
- pygamecontrols-0.1.10.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
15
- pygamecontrols-0.1.10.dist-info/top_level.txt,sha256=Tg86INulVO2XDGUPiQCC68Zsl36kBlr0My-Bn-q04V8,15
16
- pygamecontrols-0.1.10.dist-info/RECORD,,