-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Add command line option to choose a starting scene in the `testbed_*' examples #22223
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
base: main
Are you sure you want to change the base?
Add command line option to choose a starting scene in the `testbed_*' examples #22223
Conversation
apekros
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simplify the match statements
| match args.scene { | ||
| None => app.init_state::<Scene>(), | ||
| Some(Scene::Image) => app.insert_state(Scene::Image), | ||
| Some(Scene::Text) => app.insert_state(Scene::Text), | ||
| Some(Scene::Grid) => app.insert_state(Scene::Grid), | ||
| Some(Scene::Borders) => app.insert_state(Scene::Borders), | ||
| Some(Scene::BoxShadow) => app.insert_state(Scene::BoxShadow), | ||
| Some(Scene::TextWrap) => app.insert_state(Scene::TextWrap), | ||
| Some(Scene::Overflow) => app.insert_state(Scene::Overflow), | ||
| Some(Scene::Slice) => app.insert_state(Scene::Slice), | ||
| Some(Scene::LayoutRounding) => app.insert_state(Scene::LayoutRounding), | ||
| Some(Scene::LinearGradient) => app.insert_state(Scene::LinearGradient), | ||
| Some(Scene::RadialGradient) => app.insert_state(Scene::RadialGradient), | ||
| Some(Scene::Transformations) => app.insert_state(Scene::Transformations), | ||
| #[cfg(feature = "bevy_ui_debug")] | ||
| Some(Scene::DebugOutlines) => app.insert_state(Scene::DebugOutlines), | ||
| Some(Scene::ViewportCoords) => app.insert_state(Scene::ViewportCoords), | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| match args.scene { | |
| None => app.init_state::<Scene>(), | |
| Some(Scene::Image) => app.insert_state(Scene::Image), | |
| Some(Scene::Text) => app.insert_state(Scene::Text), | |
| Some(Scene::Grid) => app.insert_state(Scene::Grid), | |
| Some(Scene::Borders) => app.insert_state(Scene::Borders), | |
| Some(Scene::BoxShadow) => app.insert_state(Scene::BoxShadow), | |
| Some(Scene::TextWrap) => app.insert_state(Scene::TextWrap), | |
| Some(Scene::Overflow) => app.insert_state(Scene::Overflow), | |
| Some(Scene::Slice) => app.insert_state(Scene::Slice), | |
| Some(Scene::LayoutRounding) => app.insert_state(Scene::LayoutRounding), | |
| Some(Scene::LinearGradient) => app.insert_state(Scene::LinearGradient), | |
| Some(Scene::RadialGradient) => app.insert_state(Scene::RadialGradient), | |
| Some(Scene::Transformations) => app.insert_state(Scene::Transformations), | |
| #[cfg(feature = "bevy_ui_debug")] | |
| Some(Scene::DebugOutlines) => app.insert_state(Scene::DebugOutlines), | |
| Some(Scene::ViewportCoords) => app.insert_state(Scene::ViewportCoords), | |
| }; | |
| match args.scene { | |
| None => app.init_state::<Scene>(), | |
| Some(scene) => app.insert_state(scene), | |
| }; |
| match args.scene { | ||
| None => app.init_state::<Scene>(), | ||
| Some(Scene::Light) => app.insert_state(Scene::Light), | ||
| Some(Scene::Bloom) => app.insert_state(Scene::Bloom), | ||
| Some(Scene::Gltf) => app.insert_state(Scene::Gltf), | ||
| Some(Scene::Animation) => app.insert_state(Scene::Animation), | ||
| Some(Scene::Gizmos) => app.insert_state(Scene::Gizmos), | ||
| Some(Scene::GltfCoordinateConversion) => app.insert_state(Scene::GltfCoordinateConversion), | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| match args.scene { | |
| None => app.init_state::<Scene>(), | |
| Some(Scene::Light) => app.insert_state(Scene::Light), | |
| Some(Scene::Bloom) => app.insert_state(Scene::Bloom), | |
| Some(Scene::Gltf) => app.insert_state(Scene::Gltf), | |
| Some(Scene::Animation) => app.insert_state(Scene::Animation), | |
| Some(Scene::Gizmos) => app.insert_state(Scene::Gizmos), | |
| Some(Scene::GltfCoordinateConversion) => app.insert_state(Scene::GltfCoordinateConversion), | |
| }; | |
| match args.scene { | |
| None => app.init_state::<Scene>(), | |
| Some(scene) => app.insert_state(scene), | |
| }; |
| match args.scene { | ||
| None => app.init_state::<Scene>(), | ||
| Some(Scene::Shapes) => app.insert_state(Scene::Shapes), | ||
| Some(Scene::Bloom) => app.insert_state(Scene::Bloom), | ||
| Some(Scene::Text) => app.insert_state(Scene::Text), | ||
| Some(Scene::Sprite) => app.insert_state(Scene::Sprite), | ||
| Some(Scene::SpriteSlicing) => app.insert_state(Scene::SpriteSlicing), | ||
| Some(Scene::Gizmos) => app.insert_state(Scene::Gizmos), | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| match args.scene { | |
| None => app.init_state::<Scene>(), | |
| Some(Scene::Shapes) => app.insert_state(Scene::Shapes), | |
| Some(Scene::Bloom) => app.insert_state(Scene::Bloom), | |
| Some(Scene::Text) => app.insert_state(Scene::Text), | |
| Some(Scene::Sprite) => app.insert_state(Scene::Sprite), | |
| Some(Scene::SpriteSlicing) => app.insert_state(Scene::SpriteSlicing), | |
| Some(Scene::Gizmos) => app.insert_state(Scene::Gizmos), | |
| }; | |
| match args.scene { | |
| None => app.init_state::<Scene>(), | |
| Some(scene) => app.insert_state(scene), | |
| }; |
Objective
testbed_*examples to choose the starting scene #22218Solution
arghto check if you passed a scene name, and if you did, start on that one instead of the defaultTesting