Rust and WebAssembly: How embed non wasm 2D gui rendering code?


I'm discovering rust from 1 year, and I am thinking about using it for a 2d gui game. I heard some about rust and web assembly. I take a look about this discover tutorial and I'm testing Rust + tcod with this.

The following 2D rendering is the output of this code (you can test the code with the related repository).

My question is about: Rust + Webassembly tutorial showing how write Rust + Webassembly code. But I don't understand how I can render/include my Rust/tcod/2D rendering in a Webassembly output. If it is possible.

Is it possible ? It is "simple" (for a simple 2D/tcod -> WebAssembly render) ? If simple, can you show how wasm code is integrated ?

Thank's !

PS: My goal is to choose my stack for some years of code and learning. Like said, i tried to build this code with cargo build --target wasm32-unknown-unknown and error error[E0463]: can't find crate for 'std' printed. I'm not sure what is means. seems to be a port of a subset of libtcod to rust. According to the readme it supports WASM using stdweb. See readme how to compile.

1 Like

Thank's about this repository address a take a look !