-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Less frameworky way to run the application #313
Comments
I agree we need to offer further abstractions to ease the integration process. The
I believe the building blocks are there and now it's just a matter of gathering use cases, exploring different approaches, and finding patterns. I use the library through my own opinionated approach. Therefore, I don't believe I should be the one building or exploring these abstractions. Overall, I think this should happen as a result of a bunch of community efforts and collaboration. I placed the low-level building blocks there for this reason! On a related note, I'd like to remind anyone willing to help that, when it comes to collaboration, writing code is a very small part of the equation! It should be the last part of the process. In my experience, the best kind of collaboration happens when a user:
Code is the easy part. Before that, a considerable amount of communication, inspiration, and exploration is necessary. Please, keep this in mind if you want to take a shot at this! |
This would be a great way to sandbox ideas that may not fit into the current architecture/lifecycle. |
I'd like to get the conversation started on this topic. The earlier we discuss these things the less locked in the library will be to the provided framework. To get things going here are some things I'd like to be able to use the iced ecosystem for:
And some things I might want to implement myself or use another library/pattern for:
In the integration example you mention these 5 steps
These give us some hints to what would be nice to have. |
Heya, I've got a use case, and have halfway explored the possibility. Use case:
Currently:
As an experiment, I grabbed the initialization and event handling code from
Code of interest:
|
Given these steps, I think a good approach is:
That way we can retain the simple Sound good? (I'll begin experimenting soon) |
I just wanted to mention that the integration example has changed considerably since #354 landed. It now uses the new I think these new abstractions may help address this issue partially. Let me know! @azriel91 I haven't had a chance to review your use cases or look at your code yet. Have you taken a look at the new abstractions? They seem to align with the ideas in your last comment. |
Yeaps ✌️! The first spike is based off that. I'm hoping for abstractions that are able to simply take in "this event happened, and here is the current application context", so something like this: #[cfg(all(feature = "wgpu", feature = "winit"))]
fn main() {
let my_iced_app = MyIcedApp::new();
let mut iced_context = IcedContext::<Wgpu>::new(my_iced_app);
let event_loop = winit::event_loop::EventLoop::new();
use iced::winit::EventHandlerExt;
event_loop.run(|event, _, control_flow| {
iced_context.handle_winit_event(event, control_flow);
});
}
#[cfg(all(feature = "wgpu", not(feature = "winit")))]
fn main() {
let my_iced_app = MyIcedApp::new();
let mut iced_context = IcedContext::<Wgpu>::new(my_iced_app);
let custom_event_loop = otherloop::EventLoop::new();
custom_event_loop.run(|event| {
let iced_event = IcedEvent::from(event); // to be implemented by user.
iced_context.handle_event(event);
});
} I'm still at the envisioning stage, so while it looks rather simplistic, ideally that's the goal. |
@azriel91 I had something similar in mind when I was working on #354. Here are some thoughts:
I think once we discuss some of these, we will be able to understand the problem better. |
Heya, thank you for taking the time to look at the spike 🙇♂️.
nod, it tends towards the "God object" interface; am happy to name it something better ✌️. Storing the data hierarchically may feel better, and potentially help with sharing state (re: #27), but realistically it's still a "container for everything I think exploring the third main point should clarify my thoughts, so here we go:
I'm beginning another game engine (
This is a very good question -- I'm not sure it strictly needs to. Turning on What already exists in
Hm, good question. I haven't used
Haha, my mind's a bit done for today. May have to imagine what that looks like tomorrow. 1 Requires using |
Hello
First, I believe Iced is actually the first good-looking GUI API out there, so thanks!
Nevertheless, I have some small suggestion/feature request. There are two extremes how to run the application. One of them is the
Application::run
method that just takes care of everything and insists on managing the lifetime of the whole application, including setting up of a futures executor. On the other hand, there's the very low-level and manual way shown in https://github.com/hecrj/iced/blob/master/examples/integration/src/main.rs.I'd like to have something in between. Something less verbose and more high level than the integration example, but something that's still flexible enough to let me setup (or reuse) eg. tokio threadpool the way I want, or to start the application, let it run until someone closes the window and then run some code afterwards. I'm not sure how exactly it looks inside, but for example
hyper
went from high-level „we manage everything“ serve method in previous versions to manual set up of server and converting it into a future one can spawn on the tokio executor.I've tried scanning through the issues here and didn't find one similar, but maybe I'm not looking well enough.
The text was updated successfully, but these errors were encountered: