diff options
author | 2019-10-13 18:51:39 +0200 | |
---|---|---|
committer | 2019-10-13 18:51:39 +0200 | |
commit | 665b1d4e1b926909e6a4ccd96226b9cefe2a1ad0 (patch) | |
tree | c6f0df501e2fb1183bbde666b2bab78303cd8b6e /examples | |
parent | 734e80dea6cd39923aaa0d2f27c7368c9cbc5d62 (diff) | |
download | iced-665b1d4e1b926909e6a4ccd96226b9cefe2a1ad0.tar.gz iced-665b1d4e1b926909e6a4ccd96226b9cefe2a1ad0.tar.bz2 iced-665b1d4e1b926909e6a4ccd96226b9cefe2a1ad0.zip |
Update examples `README`
Diffstat (limited to 'examples')
-rw-r--r-- | examples/README.md | 80 |
1 files changed, 28 insertions, 52 deletions
diff --git a/examples/README.md b/examples/README.md index 4e83faf1..fe69b34a 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,78 +1,54 @@ # Examples - __Iced moves fast and the `master` branch can contain breaking changes!__ If you want to learn about a specific release, check out [the release list]. [the release list]: https://github.com/hecrj/iced/releases -## [Tour](tour) - -A simple UI tour showcasing different widgets that can be built using Iced. It -also shows how the library can be integrated into an existing system. +## [Tour](tour.rs) +A simple UI tour showcasing different widgets that can be built using Iced. The example can run both on native and web platforms, using the same GUI code! -The native renderer of the example is built on top of [`ggez`], a game library -for Rust. Currently, it is using a [personal fork] to [add a `FontCache` type] -and [fix some issues with HiDPI]. +[![Tour - Iced][gui_gif]][gui_gfycat] -The web version uses `iced_web` directly. This crate is still a work in -progress. In particular, the styling of elements is not finished yet -(text color, alignment, sizing, etc). +[gui_gif]: https://thumbs.gfycat.com/VeneratedSourAurochs-small.gif +[gui_gfycat]: https://gfycat.com/veneratedsouraurochs -The implementation consists of different modules: - - __[`tour`]__ contains the actual cross-platform GUI code: __state__, - __messages__, __update logic__ and __view logic__. - - __[`iced_ggez`]__ implements a simple renderer for each of the used widgets - on top of the graphics module of [`ggez`]. - - __[`widget`]__ conditionally re-exposes the correct platform widgets based - on the target architecture. - - __[`main`]__ integrates Iced with [`ggez`] and connects the [`tour`] with - the native [`renderer`]. - - __[`lib`]__ exposes the [`tour`] types and conditionally implements the - WebAssembly entrypoint in the [`web`] module. +On native, the example uses: + - [`iced_winit`], as a bridge between [`iced_native`] and [`winit`]. + - [`iced_wgpu`], a WIP Iced renderer built on top of [`wgpu`] and supporting + Vulkan, Metal, D3D11, and D3D12 (OpenGL and WebGL soon!). -The conditional compilation awkwardness from targetting both native and web -platforms should be handled seamlessly by the `iced` crate in the near future! +The web version uses [`iced_web`], which is still a work in progress. In +particular, the styling of elements is not finished yet (text color, alignment, +sizing, etc). -If you want to run it as a native app: +The __[`tour`]__ file contains all the code of the example! All the +cross-platform GUI is defined in terms of __state__, __messages__, +__update logic__ and __view logic__. -``` -cd examples/tour -cargo run -``` +[`tour`]: tour.rs +[`iced_winit`]: ../winit +[`iced_native`]: ../native +[`iced_wgpu`]: ../wgpu +[`iced_web`]: ../web +[`winit`]: https://github.com/rust-windowing/winit +[`wgpu`]: https://github.com/gfx-rs/wgpu-rs -If you want to run it on web, you will need [`wasm-pack`]: +#### Running the native version +Simply use [Cargo](https://doc.rust-lang.org/cargo/reference/manifest.html#examples) +to run the example: ``` -cd examples/tour -wasm-pack build --target web +cargo run --example tour ``` -Then, simply serve the directory with any HTTP server. For instance: - +#### Running the web version ``` -python3 -m http.server +TODO ``` -[![Tour - Iced][gui_gif]][gui_gfycat] - -[`ggez`]: https://github.com/ggez/ggez -[`tour`]: tour/src/tour.rs -[`iced_ggez`]: tour/src/iced_ggez -[`renderer`]: src/iced_ggez/renderer -[`widget`]: tour/src/widget.rs -[`main`]: tour/src/main.rs -[`lib`]: tour/src/lib.rs -[`web`]: tour/src/web.rs -[`wasm-pack`]: https://rustwasm.github.io/wasm-pack/installer/ -[personal fork]: https://github.com/hecrj/ggez -[add a `FontCache` type]: https://github.com/ggez/ggez/pull/679 -[fix some issues with HiDPI]: https://github.com/hecrj/ggez/commit/dfe2fd2423c51a6daf42c75f66dfaeaacd439fb1 -[gui_gif]: https://thumbs.gfycat.com/VeneratedSourAurochs-small.gif -[gui_gfycat]: https://gfycat.com/veneratedsouraurochs - ## [Coffee] |