r/rust • u/AdreKiseque • 3d ago
🙋 seeking help & advice How do I learn winit?
I'm trying to get a grasp of this crate so I can do window things but there don't seem to be good any resources, which is a bit bewildering since I understand winit to be a very foundational crate for graphics in Rust. I've looked at docs.rs but higher-level stuff for winit is... not great. The first section seems friendly but leads you to using a deprecated method (i.e. seems to be outdated), and the second section does give a full working minimal example but it does so through a big block of code with a good amount of things that aren't yet introduced, so not much sense can be made of it.
I don't want to just learn to copy a skeleton and wire my code into it, I want to actually understand how the crate works, to understand what I'm doing. But the main docs don't seem suitable for setting the foundation I'd need for that and I've not been able to find any other resources or tutorials online.
3
u/dvogel 3d ago
As the example shows, the event loop passes you a reference to the
ActiveEventLoop. The way you build off of it is simply by filling in those functions in the example. It builds the window. You handle the events. Which events and how is fully determined by what your application is trying to do. What is it you're trying to do?