| .. | ||
| resources | ||
| src | ||
| Cargo.toml | ||
| index.html | ||
| README.md | ||
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.
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.
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).
The implementation consists of different modules:
tourcontains the actual cross-platform GUI code: state, messages, update logic and view logic.iced_ggezimplements a simple renderer for each of the used widgets on top of the graphics module ofggez.widgetconditionally re-exposes the correct platform widgets based on the target architecture.mainintegrates Iced withggezand connects thetourwith the nativerenderer.libexposes thetourtypes and conditionally implements the WebAssembly entrypoint in thewebmodule.
The conditional compilation awkwardness from targetting both native and web
platforms should be handled seamlessly by the iced crate in the near future!
If you want to run it as a native app:
cd examples/tour
cargo run
If you want to run it on web, you will need wasm-pack:
cd examples/tour
wasm-pack build --target web
Then, simply serve the directory with any HTTP server. For instance:
python3 -m http.server