diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-10 16:22:08 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-10 16:22:08 +0100 |
commit | 8e1cc17bc59e3410315e42a7fe8e54f4afaae9ab (patch) | |
tree | 0ae2ac1c994b7a28736b2c3ac94f84c207956cda /client/src/state.rs | |
parent | 47e5b44576e581ae0b62ad1e3bed444b8a82cefd (diff) | |
download | weareserver-8e1cc17bc59e3410315e42a7fe8e54f4afaae9ab.tar weareserver-8e1cc17bc59e3410315e42a7fe8e54f4afaae9ab.tar.bz2 weareserver-8e1cc17bc59e3410315e42a7fe8e54f4afaae9ab.tar.zst |
can render multiple viewports
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(); |