Add egui_glow as an opt-in backend to eframe (#817)
* Make egui_glow and opt-in backend for eframe * Add egui_glow to Cargo.toml and to CI * Reference egui_glow where egui_glium is mentioned * Remove path-patches from root Cargo.toml * Add instructions on how to enable the glow backend of eframe
This commit is contained in:
parent
cf273e3519
commit
cdd4dccf5f
14 changed files with 80 additions and 22 deletions
2
.github/workflows/rust.yml
vendored
2
.github/workflows/rust.yml
vendored
|
@ -132,7 +132,7 @@ jobs:
|
||||||
toolchain: 1.54.0
|
toolchain: 1.54.0
|
||||||
override: true
|
override: true
|
||||||
- run: sudo apt-get update && sudo apt-get install libspeechd-dev
|
- run: sudo apt-get update && sudo apt-get install libspeechd-dev
|
||||||
- run: cargo doc -p emath -p epaint -p egui -p eframe -p epi -p egui_web -p egui-winit -p egui_glium --lib --no-deps --all-features
|
- run: cargo doc -p emath -p epaint -p egui -p eframe -p epi -p egui_web -p egui-winit -p egui_glium -p egui_glow --lib --no-deps --all-features
|
||||||
|
|
||||||
doc_web:
|
doc_web:
|
||||||
name: cargo doc web
|
name: cargo doc web
|
||||||
|
|
|
@ -5,7 +5,7 @@ Also see [`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUT
|
||||||
|
|
||||||
|
|
||||||
## Crate overview
|
## Crate overview
|
||||||
The crates in this repository are: `egui, emath, epaint, egui, epi, egui-winit, egui_web, egui_glium, egui_demo_lib, egui_demo_app`.
|
The crates in this repository are: `egui, emath, epaint, egui, epi, egui-winit, egui_web, egui_glium, egui_glow, egui_demo_lib, egui_demo_app`.
|
||||||
|
|
||||||
### `egui`: The main GUI library.
|
### `egui`: The main GUI library.
|
||||||
Example code: `if ui.button("Click me").clicked() { … }`
|
Example code: `if ui.button("Click me").clicked() { … }`
|
||||||
|
@ -38,7 +38,6 @@ Puts an egui app inside a native window on your laptop. Paints the triangles tha
|
||||||
|
|
||||||
### `egui_glow`
|
### `egui_glow`
|
||||||
Puts an egui app inside a native window on your laptop. Paints the triangles that egui outputs using [glow](https://github.com/grovesNL/glow).
|
Puts an egui app inside a native window on your laptop. Paints the triangles that egui outputs using [glow](https://github.com/grovesNL/glow).
|
||||||
An alternative to `egui_glium`, not used by `eframe` at this time.
|
|
||||||
|
|
||||||
### `eframe`
|
### `eframe`
|
||||||
A wrapper around `egui_web` + `egui_glium`, so you can compile the same app for either web or native.
|
A wrapper around `egui_web` + `egui_glium`, so you can compile the same app for either web or native.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
All notable changes to the egui crate will be documented in this file.
|
All notable changes to the egui crate will be documented in this file.
|
||||||
|
|
||||||
NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_web`](egui_web/CHANGELOG.md), [`egui-winit`](egui-winit/CHANGELOG.md) and [`egui_glium`](egui_glium/CHANGELOG.md) have their own changelogs!
|
NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_web`](egui_web/CHANGELOG.md), [`egui-winit`](egui-winit/CHANGELOG.md), [`egui_glium`](egui_glium/CHANGELOG.md), and [`egui_glow`](egui_glow/CHANGELOG.md) have their own changelogs!
|
||||||
|
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
39
Cargo.lock
generated
39
Cargo.lock
generated
|
@ -836,6 +836,7 @@ version = "0.14.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"egui",
|
"egui",
|
||||||
"egui_glium",
|
"egui_glium",
|
||||||
|
"egui_glow",
|
||||||
"egui_web",
|
"egui_web",
|
||||||
"epi",
|
"epi",
|
||||||
"image",
|
"image",
|
||||||
|
@ -905,6 +906,23 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "egui_glow"
|
||||||
|
version = "0.14.0"
|
||||||
|
dependencies = [
|
||||||
|
"chrono",
|
||||||
|
"directories-next",
|
||||||
|
"egui",
|
||||||
|
"egui-winit",
|
||||||
|
"epi",
|
||||||
|
"glow",
|
||||||
|
"glutin",
|
||||||
|
"image",
|
||||||
|
"memoffset",
|
||||||
|
"ron",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "egui_web"
|
name = "egui_web"
|
||||||
version = "0.14.1"
|
version = "0.14.1"
|
||||||
|
@ -1174,6 +1192,18 @@ version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "glow"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4f04649123493bc2483cbef4daddb45d40bbdae5adb221a63a23efdb0cc99520"
|
||||||
|
dependencies = [
|
||||||
|
"js-sys",
|
||||||
|
"slotmap",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glutin"
|
name = "glutin"
|
||||||
version = "0.27.0"
|
version = "0.27.0"
|
||||||
|
@ -2300,6 +2330,15 @@ version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
|
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slotmap"
|
||||||
|
version = "1.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342"
|
||||||
|
dependencies = [
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.7.0"
|
version = "1.7.0"
|
||||||
|
|
|
@ -4,6 +4,7 @@ members = [
|
||||||
"egui_demo_app",
|
"egui_demo_app",
|
||||||
"egui_demo_lib",
|
"egui_demo_lib",
|
||||||
"egui_glium",
|
"egui_glium",
|
||||||
|
"egui_glow",
|
||||||
"egui_web",
|
"egui_web",
|
||||||
"egui-winit",
|
"egui-winit",
|
||||||
"egui",
|
"egui",
|
||||||
|
@ -12,11 +13,6 @@ members = [
|
||||||
"epi",
|
"epi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[patch.crates-io]
|
|
||||||
egui = { path = 'egui' }
|
|
||||||
egui_glium = { path = 'egui_glium' }
|
|
||||||
egui_web = { path = 'egui_web' }
|
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
split-debuginfo = "unpacked" # faster debug builds on mac
|
split-debuginfo = "unpacked" # faster debug builds on mac
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Changelog for eframe
|
# Changelog for eframe
|
||||||
All notable changes to the `eframe` and `epi` crates.
|
All notable changes to the `eframe` and `epi` crates.
|
||||||
|
|
||||||
NOTE: [`egui_web`](egui_web/CHANGELOG.md), [`egui-winit`](egui-winit/CHANGELOG.md) and [`egui_glium`](egui_glium/CHANGELOG.md) have their own changelogs!
|
NOTE: [`egui_web`](egui_web/CHANGELOG.md), [`egui-winit`](egui-winit/CHANGELOG.md), [`egui_glium`](egui_glium/CHANGELOG.md), and [`egui_glow`](egui_glow/CHANGELOG.md) have their own changelogs!
|
||||||
|
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
@ -9,7 +9,7 @@ NOTE: [`egui_web`](egui_web/CHANGELOG.md), [`egui-winit`](egui-winit/CHANGELOG.m
|
||||||
* Remove "http" feature (use https://github.com/emilk/ehttp instead!).
|
* Remove "http" feature (use https://github.com/emilk/ehttp instead!).
|
||||||
* Increase native scroll speed.
|
* Increase native scroll speed.
|
||||||
* Add `App::persist_native_window` and `App::persist_egui_memory` to control what gets persisted.
|
* Add `App::persist_native_window` and `App::persist_egui_memory` to control what gets persisted.
|
||||||
* Add new backend `egui_glow` as an alternative to `egui_glium` (not yet exposed as a feature flag)
|
* Add new backend `egui_glow` as an alternative to `egui_glium`. Enable with `default-features = false, features = ["default_fonts", "egui_glow"]`.
|
||||||
|
|
||||||
|
|
||||||
## 0.14.0 - 2021-08-24
|
## 0.14.0 - 2021-08-24
|
||||||
|
|
|
@ -28,7 +28,8 @@ epi = { version = "0.14.0", path = "../epi" }
|
||||||
|
|
||||||
# For compiling natively:
|
# For compiling natively:
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
egui_glium = { version = "0.14.0", path = "../egui_glium", default-features = false, features = ["clipboard", "links"] }
|
egui_glium = { version = "0.14.0", path = "../egui_glium", default-features = false, features = ["clipboard", "links"], optional = true }
|
||||||
|
egui_glow = { version = "0.14.0", path = "../egui_glow", default-features = false, features = ["clipboard", "links"], optional = true }
|
||||||
|
|
||||||
# For compiling to web:
|
# For compiling to web:
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
|
@ -39,7 +40,7 @@ image = { version = "0.23", default-features = false, features = ["png"] }
|
||||||
rfd = "0.5.0"
|
rfd = "0.5.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["default_fonts"]
|
default = ["default_fonts", "egui_glium"]
|
||||||
|
|
||||||
# If set, egui will use `include_bytes!` to bundle some fonts.
|
# If set, egui will use `include_bytes!` to bundle some fonts.
|
||||||
# If you plan on specifying your own fonts you may disable this feature.
|
# If you plan on specifying your own fonts you may disable this feature.
|
||||||
|
|
|
@ -14,7 +14,7 @@ To get started, go to <https://github.com/emilk/eframe_template/> and follow the
|
||||||
|
|
||||||
`eframe` is a very thin crate that re-exports [`egui`](https://github.com/emilk/egui) and[`epi`](https://github.com/emilk/egui/tree/master/epi) with thin wrappers over the backends.
|
`eframe` is a very thin crate that re-exports [`egui`](https://github.com/emilk/egui) and[`epi`](https://github.com/emilk/egui/tree/master/epi) with thin wrappers over the backends.
|
||||||
|
|
||||||
`eframe` uses [`egui_web`](https://crates.io/crates/egui_web) and [`egui_glium`](https://crates.io/crates/egui_glium).
|
`eframe` uses [`egui_web`](https://github.com/emilk/egui/tree/master/egui_web) for web and [`egui_glium`](https://github.com/emilk/egui/tree/master/egui_glium) or [`egui_glow`](https://github.com/emilk/egui/tree/master/egui_glow) for native.
|
||||||
|
|
||||||
To use on Linux, first run:
|
To use on Linux, first run:
|
||||||
|
|
||||||
|
@ -24,6 +24,12 @@ sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev lib
|
||||||
|
|
||||||
|
|
||||||
## Alternatives
|
## Alternatives
|
||||||
|
The default native backend for `eframe` is currently [`egui_glium`](https://github.com/emilk/egui/tree/master/egui_glium), but you can try out the new [`egui_glow`](https://github.com/emilk/egui/tree/master/egui_glow) backend by putting this in your `Cargo.toml`:
|
||||||
|
|
||||||
|
``` toml
|
||||||
|
eframe = { version = "*", default-features = false, features = ["default_fonts", "egui_glow"] }
|
||||||
|
```
|
||||||
|
|
||||||
`eframe` is not the only way to write an app using `egui`! You can also try [`egui-miniquad`](https://github.com/not-fl3/egui-miniquad) and [`egui_sdl2_gl`](https://github.com/ArjunNair/egui_sdl2_gl).
|
`eframe` is not the only way to write an app using `egui`! You can also try [`egui-miniquad`](https://github.com/not-fl3/egui-miniquad) and [`egui_sdl2_gl`](https://github.com/ArjunNair/egui_sdl2_gl).
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
//! You write your application code for [`epi`] (implementing [`epi::App`]) and then
|
//! You write your application code for [`epi`] (implementing [`epi::App`]) and then
|
||||||
//! call from [`crate::run_native`] your `main.rs`, and/or call `eframe::start_web` from your `lib.rs`.
|
//! call from [`crate::run_native`] your `main.rs`, and/or call `eframe::start_web` from your `lib.rs`.
|
||||||
//!
|
//!
|
||||||
//! `eframe` is implemented using [`egui_web`](https://docs.rs/egui_web) and [`egui_glium`](https://docs.rs/egui_glium).
|
//! `eframe` is implemented using [`egui_web`](https://github.com/emilk/egui/tree/master/egui_web) for web and
|
||||||
|
//! [`egui_glium`](https://github.com/emilk/egui/tree/master/egui_glium) or [`egui_glow`](https://github.com/emilk/egui/tree/master/egui_glow) for native.
|
||||||
|
|
||||||
// Forbid warnings in release builds:
|
// Forbid warnings in release builds:
|
||||||
#![cfg_attr(not(debug_assertions), deny(warnings))]
|
#![cfg_attr(not(debug_assertions), deny(warnings))]
|
||||||
|
@ -61,6 +62,22 @@ pub fn start_web(canvas_id: &str, app: Box<dyn epi::App>) -> Result<(), wasm_bin
|
||||||
|
|
||||||
/// Call from `fn main` like this: `eframe::run_native(Box::new(MyEguiApp::default()))`
|
/// Call from `fn main` like this: `eframe::run_native(Box::new(MyEguiApp::default()))`
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
#[cfg(feature = "egui_glium")]
|
||||||
pub fn run_native(app: Box<dyn epi::App>, native_options: epi::NativeOptions) -> ! {
|
pub fn run_native(app: Box<dyn epi::App>, native_options: epi::NativeOptions) -> ! {
|
||||||
egui_glium::run(app, &native_options)
|
egui_glium::run(app, &native_options)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Call from `fn main` like this: `eframe::run_native(Box::new(MyEguiApp::default()))`
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
#[cfg(not(feature = "egui_glium"))] // make sure we still compile with `--all-features`
|
||||||
|
#[cfg(feature = "egui_glow")]
|
||||||
|
pub fn run_native(app: Box<dyn epi::App>, native_options: epi::NativeOptions) -> ! {
|
||||||
|
egui_glow::run(app, &native_options)
|
||||||
|
}
|
||||||
|
|
||||||
|
// disabled since we want to be able to compile with `--all-features`
|
||||||
|
// #[cfg(all(feature = "egui_glium", feature = "egui_glow"))]
|
||||||
|
// compile_error!("Enable either egui_glium or egui_glow, not both");
|
||||||
|
|
||||||
|
#[cfg(all(not(feature = "egui_glium"), not(feature = "egui_glow")))]
|
||||||
|
compile_error!("Enable either egui_glium or egui_glow");
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/// Demonstrates how to make an app using egui.
|
/// Demonstrates how to make an app using egui.
|
||||||
///
|
///
|
||||||
/// Implements `epi::App` so it can be used with
|
/// Implements `epi::App` so it can be used with
|
||||||
/// [`egui_glium`](https://crates.io/crates/egui_glium) and [`egui_web`](https://crates.io/crates/egui_web).
|
/// [`egui_glium`](https://github.com/emilk/egui/tree/master/egui_glium), [`egui_glow`](https://github.com/emilk/egui/tree/master/egui_glow) and [`egui_web`](https://github.com/emilk/egui/tree/master/egui_web).
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(default))]
|
#[cfg_attr(feature = "serde", serde(default))]
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
|
|
||||||
`epi` is a backend-agnostic interface for writing apps using `egui` (a platform agnostic GUI library).
|
`epi` is a backend-agnostic interface for writing apps using `egui` (a platform agnostic GUI library).
|
||||||
|
|
||||||
This crate provides a common interface for programming an app using egui, which can then be easily plugged into [`eframe`](https://github.com/emilk/egui/tree/master/eframe) (which is a wrapper over [`egui_web`](https://crates.io/crates/egui_web) and/or [`egui_glium`](https://crates.io/crates/egui_glium)).
|
This crate provides a common interface for programming an app using egui, which can then be easily plugged into [`eframe`](https://github.com/emilk/egui/tree/master/eframe) (which is a wrapper over [`egui_web`](https://github.com/emilk/egui/tree/master/egui_web), [`egui_glium`](https://github.com/emilk/egui/tree/master/egui_glium) and [`egui_glow`](https://github.com/emilk/egui/tree/master/egui_glow)).
|
||||||
|
|
||||||
This crate is only for those that want to write an app that can be compiled both natively and for the web.
|
This crate is only for those that want to write an app that can be compiled both natively and for the web.
|
||||||
|
|
|
@ -82,8 +82,8 @@ pub use egui; // Re-export for user convenience
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
/// Implement this trait to write apps that can be compiled both natively using the [`egui_glium`](https://crates.io/crates/egui_glium) crate,
|
/// Implement this trait to write apps that can be compiled both natively using the [`egui_glium`](https://github.com/emilk/egui/tree/master/egui_glium) crate,
|
||||||
/// and deployed as a web site using the [`egui_web`](https://crates.io/crates/egui_web) crate.
|
/// and deployed as a web site using the [`egui_web`](https://github.com/emilk/egui/tree/master/egui_web) crate.
|
||||||
pub trait App {
|
pub trait App {
|
||||||
/// Called each time the UI needs repainting, which may be many times per second.
|
/// Called each time the UI needs repainting, which may be many times per second.
|
||||||
/// Put your widgets into a [`egui::SidePanel`], [`egui::TopBottomPanel`], [`egui::CentralPanel`], [`egui::Window`] or [`egui::Area`].
|
/// Put your widgets into a [`egui::SidePanel`], [`egui::TopBottomPanel`], [`egui::CentralPanel`], [`egui::Window`] or [`egui::Area`].
|
||||||
|
|
|
@ -15,13 +15,13 @@ cargo clippy --workspace --all-targets --all-features -- -D warnings -W clippy:
|
||||||
cargo test --workspace --all-targets --all-features
|
cargo test --workspace --all-targets --all-features
|
||||||
cargo fmt --all -- --check
|
cargo fmt --all -- --check
|
||||||
|
|
||||||
cargo doc -p emath -p epaint -p egui -p eframe -p epi -p egui_web -p egui-winit -p egui_glium --lib --no-deps --all-features
|
cargo doc -p emath -p epaint -p egui -p eframe -p epi -p egui_web -p egui-winit -p egui_glium -p egui_glow --lib --no-deps --all-features
|
||||||
cargo doc -p egui_web --target wasm32-unknown-unknown --lib --no-deps --all-features
|
cargo doc -p egui_web --target wasm32-unknown-unknown --lib --no-deps --all-features
|
||||||
|
|
||||||
(cd emath && cargo check --no-default-features)
|
(cd emath && cargo check --no-default-features)
|
||||||
(cd epaint && cargo check --no-default-features --features "single_threaded")
|
(cd epaint && cargo check --no-default-features --features "single_threaded")
|
||||||
(cd egui && cargo check --no-default-features --features "multi_threaded")
|
(cd egui && cargo check --no-default-features --features "multi_threaded")
|
||||||
(cd eframe && cargo check --no-default-features)
|
(cd eframe && cargo check --no-default-features --features "egui_glow")
|
||||||
(cd epi && cargo check --no-default-features)
|
(cd epi && cargo check --no-default-features)
|
||||||
(cd egui_web && cargo check --no-default-features)
|
(cd egui_web && cargo check --no-default-features)
|
||||||
(cd egui-winit && cargo check --no-default-features)
|
(cd egui-winit && cargo check --no-default-features)
|
||||||
|
|
|
@ -4,6 +4,6 @@ script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
|
||||||
cd "$script_path/.."
|
cd "$script_path/.."
|
||||||
|
|
||||||
cargo doc -p egui_web --target wasm32-unknown-unknown --lib --no-deps --all-features
|
cargo doc -p egui_web --target wasm32-unknown-unknown --lib --no-deps --all-features
|
||||||
cargo doc -p emath -p epaint -p egui -p eframe -p epi -p egui_web -p egui-winit -p egui_glium --lib --no-deps --all-features --open
|
cargo doc -p emath -p epaint -p egui -p eframe -p epi -p egui_web -p egui-winit -p egui_glium -p egui_glow --lib --no-deps --all-features --open
|
||||||
|
|
||||||
# cargo watch -c -x 'doc -p emath -p epaint -p egui --lib --no-deps --all-features'
|
# cargo watch -c -x 'doc -p emath -p epaint -p egui --lib --no-deps --all-features'
|
||||||
|
|
Loading…
Reference in a new issue