iced/examples/README.md
Héctor Ramón Jiménez 1788d5d21e Update READMEs
2019-10-23 02:35:24 +02:00

2.6 KiB

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.

Tour

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!

Tour - Iced

On native, the example uses:

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).

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.

Running the native version

Use Cargo to run the example:

cargo run --example tour

Running the web version

Build using the wasm32-unknown-unknown target and use the wasm-bindgen CLI to generate appropriate bindings in a tour directory.

cd examples
cargo build --example tour --target wasm32-unknown-unknown
wasm-bindgen ../target/wasm32-unknown-unknown/debug/examples/tour.wasm --out-dir tour --web

Finally, serve the examples directory using an HTTP server, and access the tour.html file.

Coffee

Since Iced was born in May, it has been powering the user interfaces in Coffee, an experimental 2D game engine.

If you want to give Iced a try without having to write your own renderer, the ui module in Coffee is probably your best choice as of now.

Tour - Coffee