~rabbits/public-inbox

uxn5: Fix Controller vector behaviour for keyboard keys v1 PROPOSED

Finn Coffey: 1
 Fix Controller vector behaviour for keyboard keys

 1 files changed, 6 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~rabbits/public-inbox/patches/56950/mbox | git am -3
Learn more about email & git

[PATCH uxn5] Fix Controller vector behaviour for keyboard keys Export this patch

Ignores key-up events for regular (non-button) keys.
Clears Controller/key byte after eval-ing the vector.

---
 src/devices/controller.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/devices/controller.js b/src/devices/controller.js
index 4b01d77..cd2d733 100644
--- a/src/devices/controller.js
+++ b/src/devices/controller.js
@@ -53,6 +53,11 @@ function Controller(emu)
			event.preventDefault(); 
		}
		emu.uxn.dev[0x82] = this.state;
		emu.uxn.eval(peek16(emu.uxn.dev, 0x80))
		if(mask || event.type == "keydown") {
			emu.uxn.eval(peek16(emu.uxn.dev, 0x80))
		}
		if(event.type == "keydown") {
			emu.uxn.dev[0x83] = 0;
		}
	}
}
-- 
2.39.5 (Apple Git-154)