-
-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: port to web #1131
Comments
Does anyone have a testing environment set up? What are the requirements? If needed, we could write a window backend for the "web". |
To compile piston to web, we should have emscripten installed. And the work to port to emscripten is simple since emscripten reimplement sdl1 and support sdl2 natively. In fact, I'm already on the way, but I need some time to make clear how to deal with the main loop of sdl. |
I made a demo to show how to make rust and sdl2 work on web, hope it can help. |
I'm getting this error:
Did you do something special to get LLVM 3.9? |
Do you have llvm-link in your PATH? my llvm-link is at
The |
It works (OSX)! I copied "emsdk_portable" to "/Applications" and made the following changes:
|
FYI: I've created a piston project that can be compiled into both native and web. This project uses I initially tried using |
@gifnksm You should post this to https://www.reddit.com/r/rust_gamedev/! |
I'd like to do some research/testing to see if it is possible to implement window and input using It appears that |
It's been less than a day, and I've already travelled deeper into the rabbit hole than I ever could have anticipated. There is so much more to it than writing a window library for stdweb; we will also need to do some work to support WebGL directly. The issue that I ran into immediately is that These are the options I see moving forward:
I think I'm going to focus my efforts around number 2 for now, but I do think number 3 could also be promising for the long run, if anybody would be interested in looking into it. While I was writing this, I also found out that |
I have an update! I spent the last week developing bindings for WebGL, and I think I have a solution that is at least presentable. At first I tried to generate the bindings using a combination of I've uploaded it to a repository: webgl_loader so you can take a look at it, but I'm not confident in its correctness/soundness, and I still have to do a couple more passes to clean it up:
|
I don't know what the status of this is now, but I saw mention of |
Another note about In short, we can't implement And in fact, the example above (https://github.com/gifnksm/game-of-life-rs) defines two different |
I opened #1398 for web event loop. |
Closing. |
Since rust nightly has support asmjs and wasm, maybe It's possible that we can use piston to write web game in the soon future.
The text was updated successfully, but these errors were encountered: