jsmolka / blog

Posts and other stuff.
https://smolka.dev
Other
0 stars 0 forks source link

eggvance | virtual input overlay for mobile device #4

Closed louisgv closed 2 years ago

louisgv commented 2 years ago

Hi friend,

Love your emulator and the wasm implementation! I wanted to implement a mobile UI with an overlay DOM buttons to send input event to eggvance (i.e for mobile devices). However, after several try with something similar to:

Module.canvas.dispatchEvent(new KeyboardEvent("keydown", {
    key: "g",
  }))

I'm still unable to send input down to the emulator. I was wondering if you might have a solution to this.

Thanks in advance!

louisgv commented 2 years ago

Would it be possible for eggvance to expose a keyUp and keyDown method similar to: https://github.com/michelhe/rustboyadvance-ng/blob/master/platform/rustboyadvance-wasm/app/index.js#L228

jsmolka commented 2 years ago

You could add extra functions that edit the KEYINPUT register directly. Unfortunately I removed the WASM frontend shortly after 0.3 because I didn't want to maintain it and just did it as a proof of concept.

jsmolka commented 2 years ago

You might also try dispatching the event to the whole document instead.

louisgv commented 2 years ago

You might also try dispatching the event to the whole document instead.

I actually tried that initially, for some reason that didn't work.