Nudge letters on buttons for better button feel

main
Elijah C. Voigt 1 year ago
parent 72ea887925
commit e9c9afe2b6

@ -46,6 +46,7 @@ impl Plugin for TutorialPlugin {
(
start_tutorial_on_play
.run_if(in_state(GameState::Play))
.run_if(in_state(MenuState::Off))
.run_if(not(resource_exists::<TutorialStarted>))
.run_if(any_component_removed::<display3d::Dissolving>()),
clear_tutorial_progress.run_if(on_event::<StateTransitionEvent<TutorialState>>()),

@ -97,20 +97,24 @@ fn interactive_button(
Interaction::None => {
ui_image.texture = resting_handle.clone();
let mut ts = texts.iter_many_mut(children.iter_descendants(entity));
while let Some((_t, mut s)) = ts.fetch_next() {
s.right = Val::Auto;
debug!("TODO: Change text color");
debug!("TODO: Change position");
while let Some((mut t, mut s)) = ts.fetch_next() {
s.right = Val::Px(0.0);
s.bottom = Val::Px(0.0);
t.sections.iter_mut().for_each(|mut section| {
section.style.color = Color::WHITE;
});
}
}
Interaction::Hovered => {
ui_image.texture = depressed_handle.clone();
writer.send(audio::AudioEvent::MenuHover);
let mut ts = texts.iter_many_mut(children.iter_descendants(entity));
while let Some((_t, mut s)) = ts.fetch_next() {
s.right = Val::Px(0.0);
debug!("TODO: Change text color");
debug!("TODO: Change position");
while let Some((mut t, mut s)) = ts.fetch_next() {
s.right = Val::Px(-2.0);
s.bottom = Val::Px(-1.0);
t.sections.iter_mut().for_each(|mut section| {
section.style.color = Color::hex("E8E8E8").unwrap();
});
}
}
Interaction::Pressed => {
@ -118,9 +122,7 @@ fn interactive_button(
writer.send(audio::AudioEvent::MenuSelect);
let mut ts = texts.iter_many_mut(children.iter_descendants(entity));
while let Some((_t, mut s)) = ts.fetch_next() {
s.right = Val::Px(0.0);
debug!("TODO: Change text color");
debug!("TODO: Change position");
// TODO: Change text color
}
}
});

Loading…
Cancel
Save