-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose
WindowDestroyed
events (#9016)
# Objective I'm creating an iOS game and had to find a way to persist game state when the application is terminated. This required listening to the [`applicationWillTerminate()` method](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623111-applicationwillterminate), but I cannot do so myself anymore since `winit` already set up a delegate to listen for it, and there can be only one delegate. So I had to move up the stack and try to respond to one of the events from `winit` instead. It appears `winit` fires two events that could serve my purpose: `WindowEvent::Destroyed` and `Event::LoopDestroyed`. It seemed to me the former might be slightly more generally useful, and I also found a past discussion that suggested it would be appropriate for Bevy to have a `WindowDestroyed` event: #5589 (comment) ## Solution - I've added the `WindowDestroyed` event, which fires when `winit` fires `WindowEvent::Destroyed`. --- ## Changelog ### Added - Introduced a new `WindowDestroyed` event type. It is used to indicate a window has been destroyed by the windowing system.
- Loading branch information
Showing
3 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters