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

Splash screen allows exiting early (with escape key) #257

Merged
merged 12 commits into from
Aug 11, 2024

Conversation

will-hart
Copy link
Contributor

@will-hart will-hart commented Aug 10, 2024

This PR allows the player to exit the splash screen at any time by hitting KeyCode::escape.


Previously this PR also contained code for displaying multiple splash screens, but after discussion that will be migrated to an example in the bevy repository.

src/screens/splash.rs Outdated Show resolved Hide resolved
src/screens/splash.rs Outdated Show resolved Hide resolved
src/screens/splash.rs Outdated Show resolved Hide resolved
src/screens/splash.rs Outdated Show resolved Hide resolved
src/screens/splash.rs Outdated Show resolved Hide resolved
src/screens/splash.rs Outdated Show resolved Hide resolved
src/screens/splash.rs Show resolved Hide resolved
src/screens/splash.rs Outdated Show resolved Hide resolved
There should be a container, but let-else will prevent a
panic. The splash screen will still transition away when
all the images are worked through if there is no container.
src/screens/splash.rs Outdated Show resolved Hide resolved
src/screens/splash.rs Outdated Show resolved Hide resolved
Copy link
Member

@janhohenheim janhohenheim left a comment

Choose a reason for hiding this comment

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

Since this veers into the territory of "nice to have, but not necessary for most users", I want @alice-i-cecile's opinion on whether we should add this. I'm personally ambivalent.

In any case, consider upstreaming the code as an official example. I think it would be really helpful there :D

src/screens/splash.rs Outdated Show resolved Hide resolved
src/screens/splash.rs Outdated Show resolved Hide resolved
@alice-i-cecile
Copy link
Member

I like both of these, but strongly seconding the recommendation to upstream the splash screen code as an official example in the games folder!

@will-hart will-hart changed the title Splash screen takes images from a Resource Splash screen allows exiting early (with escape key) Aug 11, 2024
@will-hart
Copy link
Contributor Author

OK, I've removed the multi-splash screen code, resolved any discussions relating that and updated the PR description.

@benfrankel benfrankel enabled auto-merge (squash) August 11, 2024 04:46
app.add_systems(
Update,
exit_splash_screen
.run_if(input_just_pressed(KeyCode::Escape).and_then(in_state(Screen::Splash))),
Copy link
Member

Choose a reason for hiding this comment

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

I personally think that this reads better when written as two separate run_if because of the line break, but I'm not blocking on that.

Copy link
Collaborator

@benfrankel benfrankel Aug 11, 2024

Choose a reason for hiding this comment

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

IMO that's confusing because you have to know whether that yields an and or an or behavior. Would be neat if run conditions could use && somehow to improve readability.

@benfrankel benfrankel merged commit 7afa21d into TheBevyFlock:main Aug 11, 2024
4 checks passed
benfrankel added a commit to benfrankel/bevy_quickstart that referenced this pull request Aug 11, 2024
This PR allows the player to exit the splash screen at any time by
hitting `KeyCode::escape`.

---

Previously this PR also contained code for displaying multiple splash
screens, but after discussion that will be migrated to an example in the
bevy repository.

---------

Co-authored-by: Ben Frankel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants