Play Ruffle (Flash) games on mobile with the new Ruffle Virtual Keyboard userscript!
The userscript adds an onscreen virtual keyboard to Ruffle games. Tap the arrow key and spacebar buttons to play Ruffle games on mobile:
How it works
The userscript adds HTML buttons to the screen to represent arrow keys and spacebar. When pressed, the Ruffle container is focused, and then a dispatchEvent with a keyboardEvent is sent to the Ruffle container:
document.querySelector("ruffle-embed").focus(); document.querySelector("ruffle-embed").dispatchEvent(new KeyboardEvent("keydown", { key: " ", code: "Space", keyCode: 32, which: 32, bubbles: true }));
The virtual keyboardEvent is processed in the same way as a keypress from a physical keyboard
Now you can play your favorite Flash games on mobile!
Repo
https://github.com/ed253/ruffle-virtual-keyboard/
Install
- Install a mobile browser that supports addons: https://play.google.com/store/apps/details?id=org.mozilla.firefox&hl=en-US
- Install Ruffle addon: https://addons.mozilla.org/en-US/firefox/addon/ruffle_rs/
- Install Tampermonkey addon: https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/
- Install Ruffle Virtual Keyboard userscript: https://greasyfork.org/en/scripts/543622-ruffle-virtual-keyboard-for-mobile
- Enable/disable the userscript to toggle the keyboard
Extend
You can add new keys and change the color, size and position of the keyboard by editing ruffle-virtual-keyboard.js or opening the userscript in Tampermonkey
TODO
- Make the keyboard draggable and resizable
- Support different keyboard layouts and gamepads
Tips
Monero (XMR): 87vvXn5XgwHGP8YFxGDNA9LVZbAYESXpRaqNn3LR6dYgHzqJhEemN5eLXoNciR8BKUAZ32Ygc8z9UPxqmbQLZxmU4mTa81V
About Monero: https://getmonero.org
License
MIT
Top comments (0)