mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 21:30: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:
@@ -124,6 +124,8 @@ impl BackendPanel {
|
||||
|
||||
self.frame_history.ui(ui);
|
||||
|
||||
show_integration_name(ui, frame.info());
|
||||
|
||||
// For instance: `egui_web` sets `pixels_per_point` every frame to force
|
||||
// egui to use the same scale as the web zoom factor.
|
||||
let integration_controls_pixels_per_point = ui.input().raw.pixels_per_point.is_some();
|
||||
@@ -285,6 +287,27 @@ impl BackendPanel {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
fn show_integration_name(ui: &mut egui::Ui, integration_info: &epi::IntegrationInfo) {
|
||||
let name = integration_info.name;
|
||||
ui.horizontal(|ui| {
|
||||
ui.spacing_mut().item_spacing.x = 0.0;
|
||||
ui.label("Integration: ");
|
||||
match name {
|
||||
"egui_glium" | "egui_glow" | "egui_web" => {
|
||||
ui.hyperlink_to(
|
||||
name,
|
||||
format!("https://github.com/emilk/egui/tree/master/{}", name),
|
||||
);
|
||||
}
|
||||
name => {
|
||||
ui.label(name);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
struct EguiWindows {
|
||||
// egui stuff:
|
||||
|
||||
Reference in New Issue
Block a user