1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 12:50:04 -04:00

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:
Emil Ernerfeldt
2021-10-19 15:32:23 +02:00
committed by GitHub
parent cf273e3519
commit cdd4dccf5f
14 changed files with 80 additions and 22 deletions

View File

@@ -1,7 +1,7 @@
# Changelog for eframe
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
@@ -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!).
* Increase native scroll speed.
* 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

View File

@@ -28,7 +28,8 @@ epi = { version = "0.14.0", path = "../epi" }
# For compiling natively:
[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:
[target.'cfg(target_arch = "wasm32")'.dependencies]
@@ -39,7 +40,7 @@ image = { version = "0.23", default-features = false, features = ["png"] }
rfd = "0.5.0"
[features]
default = ["default_fonts"]
default = ["default_fonts", "egui_glium"]
# If set, egui will use `include_bytes!` to bundle some fonts.
# If you plan on specifying your own fonts you may disable this feature.

View File

@@ -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` 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:
@@ -24,6 +24,12 @@ sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev lib
## 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).

View File

@@ -9,7 +9,8 @@
//! 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`.
//!
//! `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:
#![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()))`
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "egui_glium")]
pub fn run_native(app: Box<dyn epi::App>, native_options: epi::NativeOptions) -> ! {
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");