-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Refactor winit_runner to make custom runners more usable #4537
Copy link
Copy link
Open
Labels
A-AppBevy apps and pluginsBevy apps and pluginsA-WindowingPlatform-agnostic interface layer to run your app inPlatform-agnostic interface layer to run your app inC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to use
Metadata
Metadata
Assignees
Labels
A-AppBevy apps and pluginsBevy apps and pluginsA-WindowingPlatform-agnostic interface layer to run your app inPlatform-agnostic interface layer to run your app inC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to use
What problem does this solve or what need does it fill?
App runners control the main loop of Bevy apps.
Unfortunately,
winitalso needs to control the main loop of the app, and thus integrating Bevy with winit requires the use of a specializedwinit_runner.This code is entirely monolithic, which makes it very challenging to reuse windowing functionality while using a specialized runner.
What solution would you like?
Refactor the contents of
winit_runnerandwinit_runner_with(which frankly just looks like it shouldn't exist at this point).The code feels like it can be split up into three parts:
winitWindowEventsinto Bevy data.What alternative(s) have you considered?
I've seen users copy-paste the code into their own runner, and make their tweaks there. This is not great, because it means any improvements or fixes we make aren't incorporated upstream.
Additional context
Discussed in the context of #4530, which will require a serious refactor anyways.