Code Monkey home page Code Monkey logo

Comments (8)

not-fl3 avatar not-fl3 commented on May 30, 2024 2

The recommended way to interop with JS: https://github.com/not-fl3/miniquad/wiki/JavaScript-interop

I am not a huge fan of using any third-party binaries for wasm and prefer just do cargo build --target wasm32-unknown-unknown. In case of gwg the only dependency requiring wasm-bindgen is getrandom (https://github.com/ggez/good-web-game/blob/master/Cargo.toml#L37). I would recommend switching to oorandom

However, if you really want to bring wasm-bindgen binary into the gwg build process here there is a good example for it: https://github.com/smokku/gwg-bindgen

from good-web-game.

Bombfuse avatar Bombfuse commented on May 30, 2024 1

Gamepad currently doesnt support WASM but I was in the middle of completing it previously. It is planned eventually to support WASM controllers without bindgen though

from good-web-game.

PSteinhaus avatar PSteinhaus commented on May 30, 2024

Hmm, I removed getrandom, but the problem remains:
Unbenannt

from good-web-game.

PSteinhaus avatar PSteinhaus commented on May 30, 2024

However, if you really want to bring wasm-bindgen binary into the gwg build process here there is a good example for it: https://github.com/smokku/gwg-bindgen

If I try to follow the example (using current good-web-game instead of the example repo and using the latest gl.js) I run into the following:

Unbenannt

from good-web-game.

PSteinhaus avatar PSteinhaus commented on May 30, 2024

Ah, it seems to be gilrs that's dependent on wasm-bindgen: https://gitlab.com/gilrs-project/gilrs#wasm

from good-web-game.

PSteinhaus avatar PSteinhaus commented on May 30, 2024

Ok, using conditional compilation I managed to keep gamepad support, while only disabling it for web and mobile.
It's probably not very elegant, but it works, good-web-game finally runs on the web once again!

But since gilrs is really the only dependency needing wasm-bindgen shouldn't it be possible to write my own bindings for it, keeping users from having to struggle with wasm-bindgen? As I said I'm a wasm and js noob, so I've no idea really, but in theory this should be possible, right? Or perhaps the more sensible way would be to just get wasm-bindgen to work once and then store the generated bindings somewhere, so that users don't have to generate them themselves when after building their projects?

from good-web-game.

not-fl3 avatar not-fl3 commented on May 30, 2024

yes, @Bombfuse made a gamepad library that works without wasm-bindgen: github.com/bombfuse/gamepad/

from good-web-game.

PSteinhaus avatar PSteinhaus commented on May 30, 2024

Yeah, I stumbled over that library and was close to asking whether you plan on continuing it, because it'd be really useful for gwg.
Good to hear that you do : )

from good-web-game.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.