Expand description
§Egui Backend Selector
Backend selector for egui that will select a backend at runtime that works on the system your application is running on.
§Example
use egui_backend_selector::{BackendConfiguration, BackendInterop};
use eframe::Storage;
struct EguiApp {}
impl EguiApp {
fn new(_context: egui::Context, _storage: Option<&dyn Storage>) -> Self {
EguiApp {}
}
}
impl egui_backend_selector::App for EguiApp {
fn ui(&mut self, ui: &mut egui::Ui, backend: BackendInterop<'_>) {
egui::CentralPanel::default().show_inside(ui, |ui| {
ui.label(format!("Hello World! Running on {}", backend.backend_name()));
});
}
}
fn you_main_function() {
egui_backend_selector::run_app("app-name", BackendConfiguration::default(), |ctx, storage| EguiApp::new(ctx, storage))
.expect("failed to run app");
}Structs§
- Backend
Configuration - Software
Backend Interop - Wrapper for the
SoftwareBackend
Enums§
- Backend
- Contains one element for each backend supported by the backend selector.
- Backend
Interop - Platform-specific interop to interact with the backend
Traits§
- App
- App traits
Functions§
- get_
backend - The function returns the backend selected to be used for egui.
- is_
launched - Returns true if the application was already launched and the selected backend can no longer be changed
by calling the
overwrite_backendfunction. - overwrite_
backend - Overwrites the selected backend. This has no effect if the application was already launched.
- run_app
- Run the app using the selected backend. If no backend has been selected yet, then this function will also select the optional backend before running the app.