notgull / async-winit Goto Github PK
View Code? Open in Web Editor NEWUse winit like the async runtime you've always wanted
Use winit like the async runtime you've always wanted
Many common patterns of GUI usage rely on being able to intercept events, making them unavailable for the rest of the system. It would be nice to be able to intercept events in Handler
.
This API is largely intended to be used from gui-tools
, which is thread unsafe. Therefore, we may want to ask whether or not we even want to be thread safe in the first place.
Not being thread safe would allow us to reduce our dependencies, as well as reduce some of the edge cases.
Playing around with the lib, I unfortunately found the following limitation ๐ข
// create some wgpu_context bundling stuff for the gfx pipeline
// ...
let resized = async {
window
.resized()
.wait_many()
.for_each(|size| {
wgpu_context.resize(size);
})
.await;
true
};
let redraw = async {
window
.redraw_requested()
.wait_many()
.for_each(|_| {
wgpu_context.render().expect("Everything is fine .. ๐ฅ");
})
.await;
true
};
// ...
This example code doesn't compile since both the resize
and render
actions need mutable access to the wgp_context
s fields. The code is running without bundling everything into the struct but it limirs the ability to abstract all the low level details away. If there is a way to get the code above running I would be very happy but I see no easy way of doing that. If you also don't have an idea how to run that code, we could maybe mention that in the "Cons" part of the README. There is no free lunch after all ๐ข ๐ฅ โ
Our current "block inside of the event handler" strategy for holding events doesn't work on the Web. I'm not sure if there is a solid way for this to translate to the Web without winit-native support for async event handlers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.