summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2026-05-02 16:12:02 -0400
committerLLLL Colonq <llll@colonq>2026-05-02 16:12:02 -0400
commit27844e551d8b91c0b953e9f534440ab937310f37 (patch)
tree8d5f3826ed6adfb23bf0de02574b0a7577c4e359 /crates
parent4c9541f35913bb8e68a07ad6ab4628d241099482 (diff)
Lock mouse on WASM
Diffstat (limited to 'crates')
-rw-r--r--crates/teleia/Cargo.toml3
-rw-r--r--crates/teleia/src/context.rs8
2 files changed, 10 insertions, 1 deletions
diff --git a/crates/teleia/Cargo.toml b/crates/teleia/Cargo.toml
index 1704309..958cbf0 100644
--- a/crates/teleia/Cargo.toml
+++ b/crates/teleia/Cargo.toml
@@ -10,7 +10,8 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
strum = { version = "0.27.1", features = ["derive"] } # utility macros for enums
glow = { version = "=0.13.1", features = [] } # rendering
-tobj = "4.0.1" # loader for .obj meshes loader
+tobj = "=4.0.1" # loader for .obj meshes loader
+ahash = "=0.8.10" # dependency of tobj
gltf = { git = "https://github.com/lcolonq/gltf", features = ["extras", "import", "names", "utils"] } # loader for .gltf scenes
image = { version = "0.25.10", default-features = false, features = ["jpeg", "png"] } # texture loader
# cosmic-text = { version = "*", default-features = false, features = ["std", "swash"] } # advanced text rendering
diff --git a/crates/teleia/src/context.rs b/crates/teleia/src/context.rs
index 6346237..211e23b 100644
--- a/crates/teleia/src/context.rs
+++ b/crates/teleia/src/context.rs
@@ -1,6 +1,8 @@
use crate::Options;
use glow::HasContext;
+
+#[cfg(not(target_arch = "wasm32"))]
use glfw::Context as _;
#[cfg(target_arch = "wasm32")]
@@ -258,6 +260,12 @@ impl Context {
}
}
+ #[cfg(target_arch = "wasm32")]
+ pub fn lock_mouse(&self) {
+ self.window.set_cursor_grab(winit::window::CursorGrabMode::Locked);
+ self.window.set_cursor_visible(false);
+ }
+
#[cfg(not(target_arch = "wasm32"))]
pub fn lock_mouse(&self) {
unsafe {