From 152fa008435cc66f5375ee7a794b261babebd31c Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Fri, 28 Apr 2023 16:44:37 -0700 Subject: [PATCH] Basic splash screen Just has key bindings for now. --- examples/scenes/src/test_scenes.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/examples/scenes/src/test_scenes.rs b/examples/scenes/src/test_scenes.rs index 5e4ca8e..deb7864 100644 --- a/examples/scenes/src/test_scenes.rs +++ b/examples/scenes/src/test_scenes.rs @@ -27,6 +27,7 @@ pub fn test_scenes() -> SceneSet { // For WASM below, must be mutable #[allow(unused_mut)] let mut scenes = vec![ + scene!(splash_screen), scene!(funky_paths), scene!(cardioid_and_friends), scene!(animated_text: animated), @@ -627,3 +628,26 @@ fn make_diamond(cx: f64, cy: f64) -> [PathEl; 5] { PathEl::ClosePath, ] } + +fn splash_screen(sb: &mut SceneBuilder, params: &mut SceneParams) { + let strings = [ + "Vello test", + "key bindings:", + " Arrow keys: switch scenes", + " S: toggle stats", + " V: toggle vsync", + " Q, E: rotate", + " Space: reset transform", + ]; + for (i, s) in strings.iter().enumerate() { + let text_size = if i == 0 { 60.0 } else { 40.0 }; + params.text.add( + sb, + None, + text_size, + None, + Affine::translate((100.0, 100.0 + 60.0 * i as f64)), + s, + ); + } +}