mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Deduplicate code found in both egui_glium and egui_glow (#819)
* Move window building to egui-winit * Move icon loading to egui-winit * `use glow::HasContext;` -> `use glow::HasContext as _;` * Move FileStorage into epi behind a feature flag * De-duplicate screen_size_in_pixels and native_pixels_per_point * Move creation of FileStorage to epi * Handle epi app output (window size changes etc) in egui-winit * Move app and memory persistence and autosave logic to egui-winit * fix check.sh * Make the epi backend opt-in for egui_glium and egui_glow * Fix persistence * Add integration name to epi::IntegrationInfo and the demo * Clean up Cargo.toml files and fix making egui_glium optional * fix typo * Make egui_glium compile without the `epi` feature
This commit is contained in:
@@ -26,12 +26,13 @@ all-features = true
|
||||
egui = { version = "0.14.0", path = "../egui", default-features = false }
|
||||
epi = { version = "0.14.0", path = "../epi" }
|
||||
|
||||
# For compiling natively:
|
||||
# native:
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
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 }
|
||||
egui-winit = { version = "0.14.0", path = "../egui-winit", default-features = false }
|
||||
egui_glium = { version = "0.14.0", path = "../egui_glium", default-features = false, features = ["clipboard", "epi", "links"], optional = true }
|
||||
egui_glow = { version = "0.14.0", path = "../egui_glow", default-features = false, features = ["clipboard", "epi", "links"], optional = true }
|
||||
|
||||
# For compiling to web:
|
||||
# web:
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
egui_web = { version = "0.14.0", path = "../egui_web", default-features = false }
|
||||
|
||||
@@ -47,7 +48,17 @@ default = ["default_fonts", "egui_glium"]
|
||||
default_fonts = ["egui/default_fonts"]
|
||||
|
||||
# Enable saving app state to disk.
|
||||
persistence = ["epi/persistence", "egui_glium/persistence", "egui_web/persistence"]
|
||||
persistence = [
|
||||
# we cannot touch egui_glium or egui_glow here due to https://github.com/rust-lang/cargo/issues/8832
|
||||
"egui-winit/persistence",
|
||||
"egui/persistence",
|
||||
"epi/file_storage",
|
||||
"epi/persistence",
|
||||
]
|
||||
|
||||
# experimental support for a screen reader
|
||||
screen_reader = ["egui_glium/screen_reader", "egui_web/screen_reader"]
|
||||
screen_reader = [
|
||||
# we cannot touch egui_glium or egui_glow here due to https://github.com/rust-lang/cargo/issues/8832
|
||||
"egui-winit/screen_reader",
|
||||
"egui_web/screen_reader",
|
||||
]
|
||||
|
||||
@@ -79,5 +79,5 @@ pub fn run_native(app: Box<dyn epi::App>, native_options: epi::NativeOptions) ->
|
||||
// #[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")))]
|
||||
#[cfg(not(any(feature = "egui_glium", feature = "egui_glow")))]
|
||||
compile_error!("Enable either egui_glium or egui_glow");
|
||||
|
||||
Reference in New Issue
Block a user