diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-10 15:35:23 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-10 15:35:23 +0100 |
commit | 47e5b44576e581ae0b62ad1e3bed444b8a82cefd (patch) | |
tree | dc669acc78003dc9de405247106832d4700f4371 /client/src/window.rs | |
parent | dbfb01fa7b5b05686dcbdd9d73643d7866810668 (diff) | |
download | weareserver-47e5b44576e581ae0b62ad1e3bed444b8a82cefd.tar weareserver-47e5b44576e581ae0b62ad1e3bed444b8a82cefd.tar.bz2 weareserver-47e5b44576e581ae0b62ad1e3bed444b8a82cefd.tar.zst |
spawn ui in world with click
Diffstat (limited to 'client/src/window.rs')
-rw-r--r-- | client/src/window.rs | 8 |
1 files changed, 7 insertions, 1 deletions
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 <https://www.gnu.org/licenses/>. */ 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(); } |