druid-wasm-examples
druid-wasm-examples copied to clipboard
Druid examples arranged for easy compilation with wasm-pack
Druid examples in WASM
This repository collects most of the Druid examples and arranges them (with very slight
modifications) for building with wasm-pack
and serving with a web server.
To get started first check out the rust wasm tutorial.
Building
You will need cargo
and wasm-pack
for building the code and a simple
server like http
for serving the web pages.
First build the examples with
> wasm-pack build --target web
Then run the server from the root directory with
> http
which should start a server with our examples served in individual html documents.
Finally point your browser to the appropriate localhost url (usually http://localhost:8000) and you should see a page with a list of links, one for each example.
Status
Examples that are known to be working (on par with native) are marked below.
- [x] anim
- [x] calc
- [x] custom_widget
- [x] either
- [ ] ext_event (No thread support on wasm)
- [x] flex
- [x] game_of_life
- [x] hello
- [x] identity
- [x] image (Image is loaded at compile time)
- [x] layout
- [x] lens
- [x] list
- [ ] multiwin (No support for menus or multiple windows)
- [x] panels
- [x] parse
- [x] scroll_colors
- [x] scroll
- [x] split_demo
- [x] styled_text
- [ ] svg (usvg doesn't compile for WASM at the time of this writing)
- [x] switch_demo
- [x] timer
- [x] view_switcher
Acknowledgements
The examples (files in the examples
module) in this repository are taken (mostly unmodified) from
the druid
library, so all credit goes to the druid
developers.