Skip to content

Add web examples#1275

Closed
ryanisaacg wants to merge 6 commits intorust-windowing:masterfrom
ryanisaacg:add-web-examples
Closed

Add web examples#1275
ryanisaacg wants to merge 6 commits intorust-windowing:masterfrom
ryanisaacg:add-web-examples

Conversation

@ryanisaacg
Copy link
Copy Markdown
Contributor

  • Tested on all platforms changed
  • Compilation warnings were addressed
  • cargo fmt has been run on this branch
  • cargo doc builds successfully
  • Created or updated an example program if it would help users understand this functionality

@goddessfreya goddessfreya added DS - web Affects the Web backend (WebAssembly/WASM) S - docs Awareness, docs, examples, etc. labels Nov 12, 2019
@Osspial
Copy link
Copy Markdown
Contributor

Osspial commented Nov 14, 2019

I ran cargo web start --example stdweb_window --features stdweb, but the code included in this PR doesn't seem to be enough to instantiate a webpage that contains a Winit window. Additionally, cargo web is giving me this message:

If you need to serve any extra files put them in the 'static' directory
in the root of your crate; they will be served alongside your application.
You can also put a 'stdweb_window-static' directory in your 'examples' directory.
Your application is being served at '/stdweb_window.js'. It will be automatically
rebuilt if you make any changes in your code.

Would it be possible to include the static files in this PR? Additionally, could we add web setup documentation to the crate's root docs?

@ryanisaacg
Copy link
Copy Markdown
Contributor Author

@Osspial

I ran cargo web start --example stdweb_window --features stdweb, but the code included in this PR doesn't seem to be enough to instantiate a webpage that contains a Winit window.

Nothing is rendered in the window, but it's there for me at least. Are you not seeing events logged / a canvas in the DOM?

We could insert some code to use webgl or HTML5 canvas to color-fill the canvas to make it obvious.

Additionally, cargo web is giving me this message:

Cargo web will give you this message if you don't have a static directory. It's just a message that warns you where to put your static assets; this PR has none.

@Osspial
Copy link
Copy Markdown
Contributor

Osspial commented Dec 2, 2019

@ryanisaacg ah, alright. I just checked the console log and events are indeed getting printed.

We could insert some code to use webgl or HTML5 canvas to color-fill the canvas to make it obvious.

Would it be easier to set the page's background color, so it contrasts against the canvas' default uncleared color?

@ryanisaacg
Copy link
Copy Markdown
Contributor Author

#1301 does this better, so I'll just make the background color change after we merge that.

@ryanisaacg ryanisaacg closed this Dec 3, 2019
@ryanisaacg ryanisaacg deleted the add-web-examples branch April 11, 2020 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DS - web Affects the Web backend (WebAssembly/WASM) S - docs Awareness, docs, examples, etc.

Development

Successfully merging this pull request may close these issues.

3 participants