Trigger key press Virtual keyboard button?
Here code I found in source (file: fceux-1dca6bb7.js) registerKeyEventCallback
->HEAP32[JSEvents.keyEvent + 156 >> 2] = e.keyCode
How can I trigger key press (like vitural keyboard button)?
Thank you.
Comments (7)
-
repo owner -
Thanks for responded.
I wanna trigger with virtual pad for smart phone on screen, I try callback events key for instead but not good.
Has this project ended and can continue?
-
repo owner There’s no support for virtual gamepads ATM. But there’s this issue, so I’ve thought about it: https://bitbucket.org/tsone/em-fceux/issues/10/.
BTW Haven’t tried but it’s possible bluetooth gamepads work on mobile browsers: https://caniuse.com/#search=gamepad.
-
FYI - you can simulate a keypress through the window:
window.dispatchEvent(new KeyboardEvent('keydown',{'keyCode':13}));
I’ve confirmed that this indeed does work on mobile devices.
-
repo owner Update, I’ve added functions
setControllerBits()
andtriggerZapper()
in em-fceux. Use these in your app to set the controllers/Zapper based on whatever input method you use, virtual gamepad etc. (See API.md for all the API functions.) -
Thanks, @Valtteri Heikkilä . It sounds good for custom gamepad.
-
repo owner - changed status to resolved
- Log in to comment
Do you intend to trigger joypad button presses (and perhaps other peripherals like Zapper)?
There’s no js API function (to WebAssembly/C++ code) to do this right now. The API is defined in
SConstruct
file. Look forexportsList
: