From 47e5b44576e581ae0b62ad1e3bed444b8a82cefd Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 10 Jan 2025 15:35:23 +0100 Subject: spawn ui in world with click --- client/src/window.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'client/src/window.rs') diff --git a/client/src/window.rs b/client/src/window.rs index 72658e5..7da0d74 100644 --- a/client/src/window.rs +++ b/client/src/window.rs @@ -15,7 +15,7 @@ along with this program. If not, see . */ use crate::state::State; -use glam::Vec3; +use glam::{Vec3, vec2}; use log::{info, warn}; use std::net::TcpStream; use winit::{ @@ -96,6 +96,12 @@ impl ApplicationHandler for WindowState { ElementState::Released => -1., }; } + WindowEvent::MouseInput { state, button, .. } => { + sta.click(button, state.is_pressed()); + } + WindowEvent::CursorMoved { position, .. } => { + sta.delta.cursor_pos = vec2(position.x as f32, position.y as f32); + } WindowEvent::CloseRequested => { event_loop.exit(); } -- cgit v1.2.3-70-g09d2