The easy way to make a Rust app with a GUI
Go to file
2020-12-26 22:55:33 +01:00
.github/workflows Add github workflows CI 2020-12-26 19:49:07 +01:00
docs Update to Egui 0.6 2020-12-26 22:55:33 +01:00
src Update to Egui 0.6 2020-12-26 22:55:33 +01:00
.gitignore Initial commit 2020-12-19 21:52:39 +01:00
build_web.sh Update to Egui 0.6 2020-12-26 22:55:33 +01:00
Cargo.lock Update to Egui 0.6 2020-12-26 22:55:33 +01:00
Cargo.toml Update to Egui 0.6 2020-12-26 22:55:33 +01:00
check.sh Update to Egui 0.6 2020-12-26 22:55:33 +01:00
README.md Update to Egui 0.6 2020-12-26 22:55:33 +01:00
setup_web.sh Initial commit 2020-12-19 21:52:39 +01:00
start_server.sh Initial commit 2020-12-19 21:52:39 +01:00

Egui Template

dependency status Build Status

This is a template repo for Egui.

The goal is for this to be the simplest way to get started writing a GUI app in Rust.

You can compile your app natively or for the web, and share it using Github Pages.

Getting started

Start by clicking "Use this template" at https://github.com/emilk/egui_template/ or follow these instructions.

src/app.rs contains a simple example app. This is just to give some inspiration - most of it can be removed if you like.

Testing locally

cargo run --release

Compiling for the web

You can compile your app to WASM and publish it as a web page. For this you need to set up some tools. There are a few simple scripts that help you with this:

./setup_web.sh
./build_web.sh
./start_server.sh
open http://127.0.0.1:8080/
  • setup_web.sh installs the tools required to build for web
  • build_web.sh compiles your code to wasm and puts it in the docs/ folder (see below)
  • start_server.sh starts a local HTTP server so you can test before you publish
  • Open http://127.0.0.1:8080/ in a web browser to view

The finished we app is found in the docs/ folder (this is so that you can easily share it with GitHub Pages). It consists of three files:

  • index.html: A few lines of HTML, CSS and JS that loads your app. You need to edit this (once) to replace egui_template with the name of your crate!
  • your_crate_bg.wasm: What the Rust code compiles to.
  • your_crate.js: Auto-generated binding between Rust and JS.

You can test the template app at https://emilk.github.io/egui_template/.

Updating Egui

As of 2020, Egui is in active development with frequent releases with breaking changes. When updating Egui, update the version string in Cargo.toml of egui, egui_glium and egui_web (they should match). You can also check out the egui_template repository to see what changes has happened to it.