diff options
Diffstat (limited to 'client/src/state.rs')
-rw-r--r-- | client/src/state.rs | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/client/src/state.rs b/client/src/state.rs index 70746d8..00a8c0b 100644 --- a/client/src/state.rs +++ b/client/src/state.rs @@ -14,15 +14,11 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -use crate::{ - camera::Camera, download::Downloader, network::Network, renderer::Renderer, ui::UiSurface, -}; +use crate::{camera::Camera, download::Downloader, network::Network, renderer::Renderer}; use anyhow::{Context, Result}; -use egui::ViewportId; use glam::{Vec2, Vec3}; use log::{info, warn}; -use rand::random; -use std::{net::TcpStream, sync::Arc, time::Instant}; +use std::{net::TcpStream, time::Instant}; use weareshared::{store::ResourceStore, tree::SceneTree}; use winit::event::MouseButton; @@ -72,21 +68,17 @@ impl<'a> State<'a> { if !down || button != MouseButton::Right { return; } - self.renderer.ui_renderer.surfaces.insert( - ViewportId::from_hash_of(random::<u128>()), - UiSurface { - transform: self.camera.new_ui_affine(), - content: Arc::new(|ctx| { - egui::Window::new("Funny window") - .default_open(true) - .show(ctx, |ui| { - ui.label("world space ui actually kinda works now"); - ui.label("Does input work?"); - ui.button("Yes").clicked(); - }); - }), - }, - ); + self.renderer + .ui_renderer + .add_surface(self.camera.new_ui_affine(), |ctx| { + egui::Window::new("Funny window") + .default_open(true) + .show(ctx, |ui| { + ui.label("world space ui actually kinda works now"); + ui.label("Does input work?"); + ui.button("Yes").clicked(); + }); + }); } pub fn update(&mut self) -> Result<()> { let now = Instant::now(); |