codetojoy

codetojoy

Programming WebAssembly with Rust: building Rogue WebAssembly game

I’m trying to build the Rogue WebAssembly game from chapter 4, using the code provided on the website.

In build.sh, the wasm-bindgen command is failing with the stack-trace at [1] below. My version of wasm-bindgen is 0.2.67. I have tried changing the Cargo.toml file to “0.2”, instead of “^0.2”, but the result is the same.

thanks!
Michael

p.s. I am enjoying the book, though it might be better to have the code hosted on GitHub?

[1] -

$ wasm-bindgen target/wasm32-unknown-unknown/debug/roguewasm.wasm --out-dir .
thread 'main' panicked at 'remaining data [23]', [SNIP]/wasm-bindgen-cli-support-0.2.67/src/descriptor.rs:109:9
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: std::panicking::rust_panic_with_hook
   6: rust_begin_unwind
   7: std::panicking::begin_panic_fmt
   8: wasm_bindgen_cli_support::descriptors::execute
   9: wasm_bindgen_cli_support::Bindgen::generate_output
  10: wasm_bindgen_cli_support::Bindgen::generate
  11: wasm_bindgen::main
  12: std::rt::lang_start::{{closure}}
  13: std::rt::lang_start_internal
  14: main

Most Liked

codetojoy

codetojoy

With wonderful help from friends [1], here are steps that enabled the jsint_roguewasm example on my machine:

  • edit index.js to import from ./pkg/roguewasm instead of ./roguewasm
  • edit src/lib.rs to import from ../index instead of ./index
  • in build.sh, replace the wasm-bindgen command with wasm-pack build

[1] - Many thanks to Chris Macrae and Evan Theriault

Popular Pragmatic Bookshelf topics Top

iPaul
page 37 ANTLRInputStream input = new ANTLRInputStream(is); as of ANTLR 4 .8 should be: CharStream stream = CharStreams.fromStream(i...
New
johnp
Running the examples in chapter 5 c under pytest 5.4.1 causes an AttributeError: ‘module’ object has no attribute ‘config’. In particula...
New
yulkin
your book suggests to use Image.toByteData() to convert image to bytes, however I get the following error: "the getter ‘toByteData’ isn’t...
New
edruder
I thought that there might be interest in using the book with Rails 6.1 and Ruby 2.7.2. I’ll note what I needed to do differently here. ...
New
herminiotorres
Hi! I know not the intentions behind this narrative when called, on page XI: mount() |&gt; handle_event() |&gt; render() but the correc...
New
leba0495
Hello! Thanks for the great book. I was attempting the Trie (chap 17) exercises and for number 4 the solution provided for the autocorre...
New
Charles
In general, the book isn’t yet updated for Phoenix version 1.6. On page 18 of the book, the authors indicate that an auto generated of ro...
New
oaklandgit
Hi, I completed chapter 6 but am getting the following error when running: thread 'main' panicked at 'Failed to load texture: IoError(O...
New
adamwoolhether
Is there any place where we can discuss the solutions to some of the exercises? I can figure most of them out, but am having trouble with...
New
andreheijstek
After running /bin/setup, the first error was: The foreman' command exists in these Ruby versions: That was easy to fix: gem install fore...
New

Other popular topics Top

New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
New
PragmaticBookshelf
“Finding the Boundaries” Hero’s Journey with Noel Rappin @noelrappin Even when you’re ultimately right about what the future ho...
New
Exadra37
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New
PragmaticBookshelf
“A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco Ever wonder how authoring books compares to writing articles?...
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New
New
AstonJ
Was just curious to see if any were around, found this one: I got 51/100: Not sure if it was meant to buy I am sure at times the b...
New
New
PragmaticBookshelf
Author Spotlight: Sophie DeBenedetto @SophieDeBenedetto The days of the traditional request-response web application are long gone, b...
New

Sub Categories: