From bd0c74644fda1c6cbdd2524c2920e81fce063648 Mon Sep 17 00:00:00 2001 From: Joona Aalto Date: Thu, 10 Oct 2024 02:51:28 +0300 Subject: [PATCH] Fix sprite and picking examples (#15803) # Objective Looks like #15489 broke some examples :) And there are some other issues as well. Gabe's brother Gabe is tiny in the `sprite_animation` example: ![kuva](https://github.com/user-attachments/assets/810ce110-ecd8-4ca5-94c8-a5655f381131) Gabe is not running in the `sprite_picking` example, and (unrelated) is also very blurry: (note that the screenshot is a bit zoomed in) ![kuva](https://github.com/user-attachments/assets/cb115a71-e3fe-41ed-817c-d5215c44adb5) Unrelated to sprites, the text in the `simple_picking` example is way too dark when hovered: ![kuva](https://github.com/user-attachments/assets/f0f9e331-8d03-44ea-becd-bf22ad68ea71) ## Solution Both Gabes are now the correct size: ![kuva](https://github.com/user-attachments/assets/08eb936a-0341-471e-90f6-2e7067871e5b) Gabe is crisp and running: ![kuva](https://github.com/user-attachments/assets/8fa158e8-2caa-4339-bbcd-2c14b7cfc04f) The text has better contrast: ![kuva](https://github.com/user-attachments/assets/2af09523-0bdc-45a7-9149-50aa9c754957) --- examples/2d/sprite_animation.rs | 1 + examples/picking/simple_picking.rs | 6 +++--- examples/picking/sprite_picking.rs | 13 +++++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/examples/2d/sprite_animation.rs b/examples/2d/sprite_animation.rs index 016168db458ab..e1a381348f284 100644 --- a/examples/2d/sprite_animation.rs +++ b/examples/2d/sprite_animation.rs @@ -129,6 +129,7 @@ fn setup( }), ..Default::default() }, + Transform::from_scale(Vec3::splat(6.0)).with_translation(Vec3::new(50.0, 0.0, 0.0)), RightSprite, animation_config_2, )); diff --git a/examples/picking/simple_picking.rs b/examples/picking/simple_picking.rs index 7bc6dfa798971..872e4aba4ae31 100644 --- a/examples/picking/simple_picking.rs +++ b/examples/picking/simple_picking.rs @@ -1,6 +1,6 @@ //! A simple scene to demonstrate picking events -use bevy::{color::palettes::css::*, prelude::*}; +use bevy::{color::palettes::tailwind::CYAN_400, prelude::*}; fn main() { let mut app = App::new(); @@ -44,13 +44,13 @@ fn setup( .observe( |evt: Trigger>, mut texts: Query<&mut TextStyle>| { let mut style = texts.get_mut(evt.entity()).unwrap(); - style.color = WHITE.into(); + style.color = Color::WHITE; }, ) .observe( |evt: Trigger>, mut texts: Query<&mut TextStyle>| { let mut style = texts.get_mut(evt.entity()).unwrap(); - style.color = BLUE.into(); + style.color = CYAN_400.into(); }, ); // circular base diff --git a/examples/picking/sprite_picking.rs b/examples/picking/sprite_picking.rs index 774ee57cddbda..79283c18b29c2 100644 --- a/examples/picking/sprite_picking.rs +++ b/examples/picking/sprite_picking.rs @@ -6,7 +6,7 @@ use std::fmt::Debug; fn main() { App::new() - .add_plugins(DefaultPlugins) + .add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest())) .add_systems(Startup, (setup, setup_atlas)) .add_systems(Update, (move_sprite, animate_sprite)) .run(); @@ -99,15 +99,20 @@ struct AnimationTimer(Timer); fn animate_sprite( time: Res