Skip to content
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

Runners explicitly call App.initialize() #690

Merged
merged 1 commit into from
Oct 18, 2020
Merged

Runners explicitly call App.initialize() #690

merged 1 commit into from
Oct 18, 2020

Conversation

smokku
Copy link
Member

@smokku smokku commented Oct 16, 2020

This change moves startup_schedule to a separate app.initialize() function that needs to be called by the runner function.

This allows the runner function to modify/prepare app environment for startup systems requirements. For example runner can insert its own resource for startup systems to use.

@@ -148,6 +148,8 @@ pub fn winit_runner(mut app: App) {
&mut create_window_event_reader,
);

app.initialize();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this is down here instead of at the top? This would be a slight change in init behavior, this now does window creation / event loop creation before running the startup systems.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to do it right before entering the main loop.

  • preparation
  • initialize()
  • loop {}

Copy link
Member Author

@smokku smokku Oct 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of this change is to have access to resources created by runner in startup systems.
It is not needed in case of bevy_winit but we should keep things consistent across different plugins.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable to me!

CHANGELOG.md Outdated Show resolved Hide resolved
@memoryruins memoryruins added the C-Code-Quality A section of code that is hard to understand or change label Oct 17, 2020
@cart cart merged commit 149c399 into bevyengine:master Oct 18, 2020
joshuajbouw pushed a commit to joshuajbouw/bevy that referenced this pull request Oct 24, 2020
@smokku smokku mentioned this pull request Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Code-Quality A section of code that is hard to understand or change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants