MCPcopy Create free account
hub / github.com/BillyDM/Firewheel / update

Method update

examples/spatial_basic/src/ui.rs:24–334  ·  view source on GitHub ↗
(&mut self, cx: &egui::Context, _frame: &mut eframe::Frame)

Source from the content-addressed store, hash-verified

22
23impl App for DemoApp {
24 fn update(&mut self, cx: &egui::Context, _frame: &mut eframe::Frame) {
25 egui::TopBottomPanel::top("top_panel").show(cx, |ui| {
26 egui::MenuBar::new().ui(ui, |ui| {
27 ui.menu_button("Menu", |ui| {
28 ui.hyperlink_to(
29 "interactive distance model graph",
30 "https://www.desmos.com/calculator/g1pbsc5m9y",
31 );
32 ui.hyperlink_to(
33 "interactive muffle model graph",
34 "https://www.desmos.com/calculator/jxp8t9ero4",
35 );
36
37 #[cfg(not(target_arch = "wasm32"))]
38 {
39 if ui.button("Quit").clicked() {
40 cx.send_viewport_cmd(egui::ViewportCommand::Close)
41 }
42 }
43 });
44 ui.add_space(16.0);
45
46 egui::widgets::global_theme_preference_switch(ui);
47 });
48 });
49
50 egui::CentralPanel::default().show(cx, |ui| {
51 let mut updated = false;
52
53 let mut linear_volume = self.audio_system.spatial_basic_node.volume.linear();
54 if ui
55 .add(
56 egui::Slider::new(&mut linear_volume, 0.0..=2.0)
57 .step_by(0.0)
58 .text("volume"),
59 )
60 .changed()
61 {
62 self.audio_system.spatial_basic_node.volume = Volume::Linear(linear_volume);
63 updated = true;
64 }
65
66 updated |= ui
67 .add(
68 egui::Slider::new(
69 &mut self.audio_system.spatial_basic_node.offset.x,
70 RANGE.clone(),
71 )
72 .step_by(0.0)
73 .text("x"),
74 )
75 .changed();
76
77 updated |= ui
78 .add(
79 egui::Slider::new(
80 &mut self.audio_system.spatial_basic_node.offset.y,
81 RANGE.clone(),

Callers

nothing calls this directly

Calls 6

uiMethod · 0.80
linearMethod · 0.80
update_memoMethod · 0.80
addMethod · 0.45
cloneMethod · 0.45
event_queueMethod · 0.45

Tested by

no test coverage detected