mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -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:
@@ -5,7 +5,7 @@
|
||||
use std::sync::{mpsc, Arc, RwLock};
|
||||
use std::thread::JoinHandle;
|
||||
|
||||
use eframe::egui;
|
||||
use eframe::egui::{self, ViewportRender};
|
||||
|
||||
fn main() -> Result<(), eframe::Error> {
|
||||
env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
|
||||
@@ -136,7 +136,16 @@ impl std::ops::Drop for MyApp {
|
||||
}
|
||||
|
||||
impl eframe::App for MyApp {
|
||||
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;
|
||||
}
|
||||
let data = self.data.clone();
|
||||
egui::Window::new("Main thread").show(ctx, move |ui, _, parent_id| {
|
||||
if ui.button("Spawn another thread").clicked() {
|
||||
|
||||
Reference in New Issue
Block a user