Compare commits

3 Commits

Author SHA1 Message Date
9411e57759 Make CloseButton observer functions private
Now that there's a UI plugin, these systems don't need to be public. So
they won't be.
2025-08-26 13:35:40 -05:00
a489cdc5e8 Add some theme TODOs on the button widgets 2025-08-26 13:35:20 -05:00
5f617a67f6 Fix a couple of lints 2025-08-26 13:28:39 -05:00
3 changed files with 12 additions and 6 deletions

View File

@@ -36,7 +36,7 @@ pub struct UiTheme {
}
impl FromWorld for UiTheme {
fn from_world(world: &mut World) -> Self {
fn from_world(_world: &mut World) -> Self {
Self {
pane_bg: SLATE_100.into(),

View File

@@ -87,7 +87,7 @@ impl RotatingMachine {
Pickable::default(),
))
.with_children(|cmds| {
let button_cmds = cmds.spawn(BigRedButton::bundle("TURN"));
let _button_cmds = cmds.spawn(BigRedButton::bundle("TURN"));
// TODO: Attach on-press observer to the button.
});
});

View File

@@ -95,8 +95,11 @@ impl BigRedButton {
///
/// I haven't figure out what will receive the on-press events, so I'm moving
/// the problem. It will not be the button's job to hook up the event notice.
///
/// TODO: Pass in the UiTheme struct
fn bundle(text: impl Into<String>) -> impl Bundle {
(
// TODO: Remove `Button`? Add `Button` to the `CloseButton` bundle?
Button,
BigRedButton,
Node {
@@ -182,8 +185,11 @@ pub struct CloseButton(Entity);
impl CloseButton {
/// Spawn a button that will despawn the top-most node when pressed.
///
/// TODO: Pass in the UiTheme struct
fn bundle(target: Entity) -> impl Bundle {
(
// TODO: Add `Button`? Remove `Button` from the BigRedButton bundle?
CloseButton(target),
Node {
width: Px(20.0),
@@ -208,7 +214,7 @@ impl CloseButton {
)
}
pub fn hover_start(
fn hover_start(
event: Trigger<Pointer<Over>>,
// Get button background and border colors so we can change them.
// Filter for *changed* interactions, and only entities with a [`Button`]
@@ -222,7 +228,7 @@ impl CloseButton {
}
}
pub fn hover_stop(
fn hover_stop(
event: Trigger<Pointer<Out>>,
mut button_colors: Query<(&mut BackgroundColor, &mut BorderColor), With<CloseButton>>,
ui_theme: Res<UiTheme>,
@@ -233,7 +239,7 @@ impl CloseButton {
}
}
pub fn press_start(
fn press_start(
event: Trigger<Pointer<Pressed>>,
mut button_colors: Query<(&mut BackgroundColor, &mut BorderColor), With<CloseButton>>,
ui_theme: Res<UiTheme>,
@@ -244,7 +250,7 @@ impl CloseButton {
}
}
pub fn press_stop(
fn press_stop(
event: Trigger<Pointer<Released>>,
mut commands: Commands,
mut button_colors: Query<(&mut BackgroundColor, &mut BorderColor, &CloseButton)>,