From 6c0e0437773738533587a08d53aa534216c22e4c Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Sat, 9 Aug 2025 11:51:02 +0200 Subject: Added support for multiple controllers (Playstation) --- README.md | 24 ++++++++++++------------ stdlib/button.lua | 20 ++++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index b12ffa4..29d5748 100644 --- a/README.md +++ b/README.md @@ -82,18 +82,18 @@ close_window() ### Controller mappings -| Button | Keyboard | Xbox | Playstation | Nintendo | -| ------------------ | -------- | ---- | ----------- | -------- | -| `button.PAD_UP` | `W` | N/A | N/A | N/A | -| `button.PAD_DOWN` | `S` | N/A | N/A | N/A | -| `button.PAD_LEFT` | `A` | N/A | N/A | N/A | -| `button.PAD_RIGHT` | `D` | N/A | N/A | N/A | -| `button.A` | `L` | N/A | N/A | N/A | -| `button.B` | `P` | N/A | N/A | N/A | -| `button.X` | `K` | N/A | N/A | N/A | -| `button.Y` | `O` | N/A | N/A | N/A | -| `button.SELECT` | `Q` | N/A | N/A | N/A | -| `button.START` | `E` | N/A | N/A | N/A | +| Button | Keyboard | Xbox | Playstation | +| ------------------ | -------- | ------------- | ------------- | +| `button.PAD_UP` | `W` | `D-pad Up` | `D-PAD UP` | +| `button.PAD_DOWN` | `S` | `D-pad Down` | `D-PAD DOWN` | +| `button.PAD_LEFT` | `A` | `D-pad Left` | `D-PAD LEFT` | +| `button.PAD_RIGHT` | `D` | `D-pad Right` | `D-PAD RIGHT` | +| `button.A` | `L` | `A` | `Cross` | +| `button.B` | `P` | `B` | `Circle` | +| `button.X` | `K` | `X` | `Square` | +| `button.Y` | `O` | `Y` | `Triangle` | +| `button.SELECT` | `Q` | `Back` | `Share` | +| `button.START` | `E` | `Start` | `Options` | ### Default colors diff --git a/stdlib/button.lua b/stdlib/button.lua index 02b8358..f629dc9 100644 --- a/stdlib/button.lua +++ b/stdlib/button.lua @@ -1,16 +1,16 @@ local button = {} -button.PAD_UP = { keyboard = 87, xbox = 1, playstation = 0 } -- Key: W -button.PAD_DOWN = { keyboard = 83, xbox = 3, playstation = 0 } -- Key: S -button.PAD_LEFT = { keyboard = 65, xbox = 4, playstation = 0 } -- Key: A -button.PAD_RIGHT = { keyboard = 68, xbox = 2, playstation = 0 } -- Key: D +button.PAD_UP = { keyboard = 87, xbox = 1, playstation = 1 } -- Key: W +button.PAD_DOWN = { keyboard = 83, xbox = 3, playstation = 2 } -- Key: S +button.PAD_LEFT = { keyboard = 65, xbox = 4, playstation = 3 } -- Key: A +button.PAD_RIGHT = { keyboard = 68, xbox = 2, playstation = 4 } -- Key: D -button.A = { keyboard = 76, xbox = 7, playstation = 0 } -- Key: L -button.B = { keyboard = 80, xbox = 6, playstation = 0 } -- Key: P -button.X = { keyboard = 75, xbox = 8, playstation = 0 } -- Key: K -button.Y = { keyboard = 79, xbox = 5, playstation = 0 } -- Key: O +button.A = { keyboard = 76, xbox = 7, playstation = 7 } -- Key: L +button.B = { keyboard = 80, xbox = 6, playstation = 6 } -- Key: P +button.X = { keyboard = 75, xbox = 8, playstation = 8 } -- Key: K +button.Y = { keyboard = 79, xbox = 5, playstation = 5 } -- Key: O -button.SELECT = { keyboard = 81, xbox = 13, playstation = 0 } -- Key: Q -button.START = { keyboard = 69, xbox = 15, playstation = 0 } -- Key: E +button.SELECT = { keyboard = 81, xbox = 13, playstation = 13 } -- Key: Q +button.START = { keyboard = 69, xbox = 15, playstation = 15 } -- Key: E return button -- cgit v1.2.3