summaryrefslogtreecommitdiff
path: root/client/src/state.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-01-18 00:57:22 +0100
committermetamuffin <metamuffin@disroot.org>2025-01-18 00:57:22 +0100
commit6703f1c56605ca7dca8f7fe87b79badb764bd461 (patch)
treee2cb0863c3a844b20cfcb6ae1ab987a7f7ab0a6a /client/src/state.rs
parentf5ffcaf01b91daf0019dd6534b035398fa51f2f0 (diff)
downloadweareserver-6703f1c56605ca7dca8f7fe87b79badb764bd461.tar
weareserver-6703f1c56605ca7dca8f7fe87b79badb764bd461.tar.bz2
weareserver-6703f1c56605ca7dca8f7fe87b79badb764bd461.tar.zst
profiler interface
Diffstat (limited to 'client/src/state.rs')
-rw-r--r--client/src/state.rs35
1 files changed, 13 insertions, 22 deletions
diff --git a/client/src/state.rs b/client/src/state.rs
index 60be957..439b7ca 100644
--- a/client/src/state.rs
+++ b/client/src/state.rs
@@ -15,7 +15,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use crate::{
- audio::Audio, camera::Camera, download::Downloader, network::Network, renderer::Renderer,
+ audio::Audio,
+ camera::Camera,
+ download::Downloader,
+ interfaces::{InterfaceData, ui_selector},
+ network::Network,
+ renderer::Renderer,
ui::UiEvent,
};
use anyhow::{Context, Result};
@@ -98,29 +103,15 @@ impl<'a> State<'a> {
if !down || button != MouseButton::Right {
return;
}
- let pi = self.prefab_index.clone();
- let net = self.network.clone();
+ let idata = Arc::new(InterfaceData {
+ scene_prepare: self.renderer.scene_prepare.clone(),
+ downloader: self.downloader.clone(),
+ network: self.network.clone(),
+ prefab_index: self.prefab_index.clone(),
+ });
self.renderer
.ui_renderer
- .add_surface(self.camera.new_ui_affine(), move |ctx| {
- let mut open = true;
- egui::Window::new("Prefab Index")
- .open(&mut open)
- .show(ctx, |ui| {
- for (key, res) in &pi.0 {
- ui.horizontal(|ui| {
- ui.label(key);
- if ui.button("Add").clicked() {
- info!("spawn {res}");
- net.packet_send
- .send(Packet::Add(Object::new(), res.clone()))
- .unwrap();
- }
- });
- }
- });
- open
- });
+ .add_surface(self.camera.new_ui_affine(), ui_selector(idata));
}
pub fn update(&mut self) -> Result<()> {
let now = Instant::now();