mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Add Shape::Callback to do custom rendering inside of an egui UI (#1351)
* Add Shape::Callback to do custom rendering inside of an egui UI * Use Rc<glow::Context> everywhere * Remove trait WebPainter * Add glow::Context to epi::App::setup
This commit is contained in:
@@ -24,6 +24,12 @@ default = ["clipboard", "dark-light", "links"]
|
||||
# if disabled a clipboard will be simulated so you can still copy/paste within the egui app.
|
||||
clipboard = ["copypasta"]
|
||||
|
||||
# implement bytemuck on most types.
|
||||
convert_bytemuck = ["egui/convert_bytemuck"]
|
||||
|
||||
# Only for `egui_glow` - the official eframe/epi backend.
|
||||
epi_backend = ["epi", "glow"]
|
||||
|
||||
# enable opening links in a browser when an egui hyperlink is clicked.
|
||||
links = ["webbrowser"]
|
||||
|
||||
@@ -36,9 +42,6 @@ persistence = [
|
||||
] # can't add epi/persistence here because of https://github.com/rust-lang/cargo/issues/8832
|
||||
serialize = ["egui/serialize", "serde"]
|
||||
|
||||
# implement bytemuck on most types.
|
||||
convert_bytemuck = ["egui/convert_bytemuck"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
egui = { version = "0.17.0", path = "../egui", default-features = false, features = [
|
||||
@@ -53,6 +56,7 @@ epi = { version = "0.17.0", path = "../epi", optional = true }
|
||||
|
||||
copypasta = { version = "0.7", optional = true }
|
||||
dark-light = { version = "0.2.1", optional = true } # detect dark mode system preference
|
||||
glow = { version = "0.11", optional = true }
|
||||
serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||
webbrowser = { version = "0.6", optional = true }
|
||||
|
||||
|
||||
@@ -232,6 +232,7 @@ impl EpiIntegration {
|
||||
integration_name: &'static str,
|
||||
max_texture_side: usize,
|
||||
window: &winit::window::Window,
|
||||
gl: &std::rc::Rc<glow::Context>,
|
||||
repaint_signal: std::sync::Arc<dyn epi::backend::RepaintSignal>,
|
||||
persistence: crate::epi::Persistence,
|
||||
app: Box<dyn epi::App>,
|
||||
@@ -271,7 +272,7 @@ impl EpiIntegration {
|
||||
can_drag_window: false,
|
||||
};
|
||||
|
||||
slf.setup(window);
|
||||
slf.setup(window, gl);
|
||||
if slf.app.warm_up_enabled() {
|
||||
slf.warm_up(window);
|
||||
}
|
||||
@@ -279,9 +280,9 @@ impl EpiIntegration {
|
||||
slf
|
||||
}
|
||||
|
||||
fn setup(&mut self, window: &winit::window::Window) {
|
||||
fn setup(&mut self, window: &winit::window::Window, gl: &std::rc::Rc<glow::Context>) {
|
||||
self.app
|
||||
.setup(&self.egui_ctx, &self.frame, self.persistence.storage());
|
||||
.setup(&self.egui_ctx, &self.frame, self.persistence.storage(), gl);
|
||||
let app_output = self.frame.take_app_output();
|
||||
|
||||
if app_output.quit {
|
||||
|
||||
Reference in New Issue
Block a user