Questions tagged [winit]

18 questions
0
votes
0 answers

Is there a way to know whether a mouse is grabbed or not when using the winit crate?

I want to grab it when user clicks on the window and ungrab when Esc is pressed. I could keep a boolean flag in my code but what if the window loses focus in some unexpected way and the mouse becomes released without me knowing about it?
alagris
  • 1,838
  • 16
  • 31
0
votes
0 answers

Why does introducing another scope crash my winit window?

I think I might have missed something about rust scoping, but I am very confused. I thought that the below code snippets would behave exactly the same, except that in the second, the _window variable is in its own scope (which really shouldn't…
frankenapps
  • 5,800
  • 6
  • 28
  • 69
0
votes
1 answer

How to propagate error out of a closure? (Rust, winit crate's event loop)

"this_function_returns_error" returns Result and I need to propagate it back to main. Signature of the run function: https://docs.rs/winit/0.25.0/winit/event_loop/struct.EventLoop.html#method.run Simplified example of what I need mean: use winit::{ …
Etwus
  • 549
  • 5
  • 15
1
2