|
|
|
|
|
by TomasSedovic
3012 days ago
|
|
To add a specific example here, I've recently compiled a roguelike I'm working on to WASM, not knowing what to expect when I started. This required only a handful of changes across the codebase (mostly handling external resources such as the filesystem and the random generator) and then implementing a bit of JavaScript that took the drawcalls from the WASM core and rendered them on the canvas. And vice-versa, a bit of JS that passed the browser input into the WASM game. Since the original game had no concept of a DOM, it didn't matter to it. I think WASM can be huge for browser games. But like Steve said, you can call any JavaScript function and manipulate the DOM that way. At least for Rust, there's also a library that does this for you. So you can have Rust code that uses a DOM API and the WASM <-> JS bridge is handled for you: https://github.com/koute/stdweb |
|