mirror of https://github.com/emilk/egui.git
Browse Source
* Move examples out of eframe/examples into examples/ Give each example a `Cargo.toml` and `src/main.rs`. This makes it easier for people to use as templates. * Update README.md with more deps needed on vanilla Ubuntu * Install libgtk-3-dev on CI, hoping that will fix somethingpull/1493/head
Emil Ernerfeldt
3 years ago
committed by
GitHub
46 changed files with 317 additions and 71 deletions
@ -1,6 +1,7 @@ |
|||
There are no stand-alone egui examples, because egui is not stand-alone! |
|||
|
|||
There are plenty of examples in [the online demo](https://www.egui.rs/#demo). You can find the source code for it at <https://github.com/emilk/egui/tree/master/egui_demo_lib>. |
|||
See the top-level [examples](https://github.com/emilk/egui/tree/master/examples/) folder instead. |
|||
|
|||
There are also plenty of examples in [the online demo](https://www.egui.rs/#demo). You can find the source code for it at <https://github.com/emilk/egui/tree/master/egui_demo_lib>. |
|||
|
|||
If you are using `eframe`, the [crate examples](https://github.com/emilk/egui/tree/master/examples) and [single-file examples](https://github.com/emilk/egui/tree/master/eframe/examples). |
|||
To learn how to set up `eframe` for web and native, go to <https://github.com/emilk/eframe_template/> and follow the instructions there! |
|||
|
@ -1 +1,6 @@ |
|||
Examples of how to use [`eframe`](https://github.com/emilk/egui/tree/master/eframe) and [`egui`](https://github.com/emilk/egui/). |
|||
# `egui` and `eframe` examples |
|||
All the examples in this folder uses [`eframe`](https://github.com/emilk/egui/tree/master/eframe) to set up a window for [`egui`](https://github.com/emilk/egui/). Some examples are specific to `eframe`, but many are applicable to any `egui` integration. |
|||
|
|||
There are a lot more examples at <https://www.egui.rs>, and it has links to the source code of each example. |
|||
|
|||
Also check out the official docs at <https://docs.rs/egui> and <https://docs.rs/eframe>. |
|||
|
@ -0,0 +1,12 @@ |
|||
[package] |
|||
name = "confirm_exit" |
|||
version = "0.1.0" |
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"] |
|||
license = "MIT OR Apache-2.0" |
|||
edition = "2021" |
|||
rust-version = "1.60" |
|||
publish = false |
|||
|
|||
|
|||
[dependencies] |
|||
eframe = { path = "../../eframe" } |
@ -0,0 +1,3 @@ |
|||
```sh |
|||
cargo run -p confirm_exit |
|||
``` |
@ -0,0 +1,14 @@ |
|||
[package] |
|||
name = "custom_3d_glow" |
|||
version = "0.1.0" |
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"] |
|||
license = "MIT OR Apache-2.0" |
|||
edition = "2021" |
|||
rust-version = "1.60" |
|||
publish = false |
|||
|
|||
|
|||
[dependencies] |
|||
eframe = { path = "../../eframe" } |
|||
egui_glow = { path = "../../egui_glow" } |
|||
glow = "0.11" |
@ -0,0 +1,15 @@ |
|||
This demo shows how to embed 3D rendering using [`glow`](https://github.com/grovesNL/glow) in `eframe`. |
|||
|
|||
This is very advanced usage, and you need to be careful. |
|||
|
|||
If you want an easier way to show 3D graphics with egui, take a look at the `custom_3d_three-d.rs` example. |
|||
|
|||
If you are content of having egui sit on top of a 3D background, take a look at: |
|||
|
|||
* [`bevy_egui`](https://github.com/mvlabat/bevy_egui) |
|||
* [`three-d`](https://github.com/asny/three-d) |
|||
|
|||
|
|||
```sh |
|||
cargo run -p custom_3d_glow |
|||
``` |
@ -1,14 +1,3 @@ |
|||
//! This demo shows how to embed 3D rendering using [`glow`](https://github.com/grovesNL/glow) in `eframe`.
|
|||
//!
|
|||
//! This is very advanced usage, and you need to be careful.
|
|||
//!
|
|||
//! If you want an easier way to show 3D graphics with egui, take a look at the `custom_3d_three-d.rs` example.
|
|||
//!
|
|||
//! If you are content of having egui sit on top of a 3D background, take a look at:
|
|||
//!
|
|||
//! * [`bevy_egui`](https://github.com/mvlabat/bevy_egui)
|
|||
//! * [`three-d`](https://github.com/asny/three-d)
|
|||
|
|||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
|||
#![allow(unsafe_code)] |
|||
|
@ -0,0 +1,15 @@ |
|||
[package] |
|||
name = "custom_3d_three-d" |
|||
version = "0.1.0" |
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"] |
|||
license = "MIT OR Apache-2.0" |
|||
edition = "2021" |
|||
rust-version = "1.60" |
|||
publish = false |
|||
|
|||
|
|||
[dependencies] |
|||
eframe = { path = "../../eframe" } |
|||
egui_glow = { path = "../../egui_glow" } |
|||
glow = "0.11" |
|||
three-d = { version = "0.11", default-features = false } |
@ -0,0 +1,16 @@ |
|||
This demo shows how to embed 3D rendering using [`three-d`](https://github.com/asny/three-d) in `eframe`. |
|||
|
|||
Any 3D library built on top of [`glow`](https://github.com/grovesNL/glow) can be used in `eframe`. |
|||
|
|||
Alternatively you can render 3D stuff to a texture and display it using [`egui::Ui::image`]. |
|||
|
|||
If you are content of having egui sit on top of a 3D background, take a look at: |
|||
|
|||
* [`bevy_egui`](https://github.com/mvlabat/bevy_egui) |
|||
* [`three-d`](https://github.com/asny/three-d) |
|||
|
|||
|
|||
|
|||
```sh |
|||
cargo run -p custom_3d_three-d |
|||
``` |
@ -1,14 +1,3 @@ |
|||
//! This demo shows how to embed 3D rendering using [`three-d`](https://github.com/asny/three-d) in `eframe`.
|
|||
//!
|
|||
//! Any 3D library built on top of [`glow`](https://github.com/grovesNL/glow) can be used in `eframe`.
|
|||
//!
|
|||
//! Alternatively you can render 3D stuff to a texture and display it using [`egui::Ui::image`].
|
|||
//!
|
|||
//! If you are content of having egui sit on top of a 3D background, take a look at:
|
|||
//!
|
|||
//! * [`bevy_egui`](https://github.com/mvlabat/bevy_egui)
|
|||
//! * [`three-d`](https://github.com/asny/three-d)
|
|||
|
|||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
|||
|
|||
use eframe::egui; |
@ -0,0 +1,12 @@ |
|||
[package] |
|||
name = "custom_font" |
|||
version = "0.1.0" |
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"] |
|||
license = "MIT OR Apache-2.0" |
|||
edition = "2021" |
|||
rust-version = "1.60" |
|||
publish = false |
|||
|
|||
|
|||
[dependencies] |
|||
eframe = { path = "../../eframe" } |
@ -0,0 +1,3 @@ |
|||
```sh |
|||
cargo run -p custom_font |
|||
``` |
@ -0,0 +1,12 @@ |
|||
[package] |
|||
name = "custom_window_frame" |
|||
version = "0.1.0" |
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"] |
|||
license = "MIT OR Apache-2.0" |
|||
edition = "2021" |
|||
rust-version = "1.60" |
|||
publish = false |
|||
|
|||
|
|||
[dependencies] |
|||
eframe = { path = "../../eframe" } |
@ -0,0 +1,3 @@ |
|||
```sh |
|||
cargo run -p custom_window_frame |
|||
``` |
@ -0,0 +1,16 @@ |
|||
[package] |
|||
name = "download_image" |
|||
version = "0.1.0" |
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"] |
|||
license = "MIT OR Apache-2.0" |
|||
edition = "2021" |
|||
rust-version = "1.60" |
|||
publish = false |
|||
|
|||
|
|||
[dependencies] |
|||
eframe = { path = "../../eframe" } |
|||
egui_extras = { path = "../../egui_extras", features = ["image"] } |
|||
ehttp = "0.2" |
|||
image = { version = "0.24", default-features = false, features = ["jpeg"] } |
|||
poll-promise = "0.1" |
@ -0,0 +1,3 @@ |
|||
```sh |
|||
cargo run -p download_image |
|||
``` |
@ -0,0 +1,13 @@ |
|||
[package] |
|||
name = "file_dialog" |
|||
version = "0.1.0" |
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"] |
|||
license = "MIT OR Apache-2.0" |
|||
edition = "2021" |
|||
rust-version = "1.60" |
|||
publish = false |
|||
|
|||
|
|||
[dependencies] |
|||
eframe = { path = "../../eframe" } |
|||
rfd = "0.8" |
@ -0,0 +1,5 @@ |
|||
How to show a file dialog using [`rfd`](https://github.com/PolyMeilex/rfd). |
|||
|
|||
```sh |
|||
cargo run -p file_dialog |
|||
``` |
@ -0,0 +1,12 @@ |
|||
[package] |
|||
name = "hello_world" |
|||
version = "0.1.0" |
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"] |
|||
license = "MIT OR Apache-2.0" |
|||
edition = "2021" |
|||
rust-version = "1.60" |
|||
publish = false |
|||
|
|||
|
|||
[dependencies] |
|||
eframe = { path = "../../eframe" } |
@ -0,0 +1,3 @@ |
|||
```sh |
|||
cargo run -p hello_world |
|||
``` |
@ -0,0 +1,14 @@ |
|||
[package] |
|||
name = "retained_image" |
|||
version = "0.1.0" |
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"] |
|||
license = "MIT OR Apache-2.0" |
|||
edition = "2021" |
|||
rust-version = "1.60" |
|||
publish = false |
|||
|
|||
|
|||
[dependencies] |
|||
eframe = { path = "../../eframe" } |
|||
egui_extras = { path = "../../egui_extras", features = ["image"] } |
|||
image = { version = "0.24", default-features = false, features = ["png"] } |
@ -0,0 +1,3 @@ |
|||
```sh |
|||
cargo run -p retained_image |
|||
``` |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
@ -0,0 +1,13 @@ |
|||
[package] |
|||
name = "svg" |
|||
version = "0.1.0" |
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"] |
|||
license = "MIT OR Apache-2.0" |
|||
edition = "2021" |
|||
rust-version = "1.60" |
|||
publish = false |
|||
|
|||
|
|||
[dependencies] |
|||
eframe = { path = "../../eframe" } |
|||
egui_extras = { path = "../../egui_extras", features = ["svg"] } |
@ -0,0 +1,6 @@ |
|||
Example how to show an SVG image. |
|||
|
|||
|
|||
```sh |
|||
cargo run -p svg |
|||
``` |
@ -0,0 +1 @@ |
|||
Rust logo by Mozilla, from https://github.com/rust-lang/rust-artwork |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Loading…
Reference in new issue