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

Now App::update will be responsabile for what viewport will be drawned and its content

A big refactoring was needed
This commit is contained in:
Konkitoman
2023-07-25 10:54:31 +03:00
parent 19f807b4e9
commit 93a7c018d7
22 changed files with 290 additions and 45 deletions

View File

@@ -1,7 +1,7 @@
use std::sync::Arc;
use eframe::egui_glow;
use egui::mutex::Mutex;
use egui::{mutex::Mutex, ViewportRender};
use egui_glow::glow;
pub struct Custom3d {
@@ -21,7 +21,16 @@ impl Custom3d {
}
impl eframe::App for Custom3d {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
fn update(
&mut self,
ctx: &egui::Context,
frame: &mut eframe::Frame,
render: Option<&ViewportRender>,
) {
if let Some(render) = render {
render(ctx, frame.viewport_id(), frame.parent_viewport_id());
return;
}
egui::CentralPanel::default().show(ctx, |ui| {
egui::ScrollArea::both()
.auto_shrink([false; 2])