Skip to content

Commit

Permalink
Add reflect(Component)
Browse files Browse the repository at this point in the history
  • Loading branch information
benfrankel committed Jul 21, 2024
1 parent de58fd8 commit 9dcca8c
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/animation/transition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub(super) fn plugin(app: &mut App) {
}

#[derive(Component, Reflect)]
#[reflect(Component)]
pub struct FadeIn {
duration: f32,
remaining: f32,
Expand Down Expand Up @@ -49,6 +50,7 @@ fn apply_fade_in(
}

#[derive(Component, Reflect)]
#[reflect(Component)]
pub struct FadeOut {
duration: f32,
remaining: f32,
Expand Down
1 change: 1 addition & 0 deletions src/core/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ impl FromWorld for CameraRoot {
// Camera zoom-independent scale
// (workaround for https://github.com/bevyengine/bevy/issues/1890)
#[derive(Component, Reflect)]
#[reflect(Component)]
pub struct AbsoluteScale(pub Vec3);

impl Configure for AbsoluteScale {
Expand Down
2 changes: 2 additions & 0 deletions src/core/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ impl ThemeColor {
}

#[derive(Component, Reflect, Default)]
#[reflect(Component)]
pub struct ThemeColorFor<C: Component + ColorMut>(
pub ThemeColor,
#[reflect(ignore)] PhantomData<C>,
Expand Down Expand Up @@ -106,6 +107,7 @@ impl<C: Component + ColorMut + TypePath> Configure for ThemeColorFor<C> {
}

#[derive(Component, Reflect, Default)]
#[reflect(Component)]
pub struct ThemeColorForText(pub Vec<ThemeColor>);

impl Configure for ThemeColorForText {
Expand Down
1 change: 1 addition & 0 deletions src/screen/loading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub(super) fn plugin(app: &mut App) {
}

#[derive(Component, Reflect)]
#[reflect(Component)]
struct IsLoadingBarFill;

fn enter_loading(mut commands: Commands, ui_root: Res<UiRoot>) {
Expand Down
1 change: 1 addition & 0 deletions src/ui/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub const THICK_FONT_HANDLE: Handle<Font> =
Handle::weak_from_u128(93153499609634570285243616548722721367);

#[derive(Component, Reflect)]
#[reflect(Component)]
pub struct DynamicFontSize {
pub size: Val,
pub step: f32,
Expand Down
2 changes: 2 additions & 0 deletions src/ui/interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub(super) fn plugin(app: &mut App) {
}

#[derive(Component, Reflect)]
#[reflect(Component)]
pub struct IsDisabled(pub bool);

impl Configure for IsDisabled {
Expand All @@ -24,6 +25,7 @@ impl Configure for IsDisabled {
/// The theme color to use for each Interaction state
/// Requires Interaction and ThemeColor components to function
#[derive(Component, Reflect)]
#[reflect(Component)]
pub struct InteractionPalette {
pub normal: ThemeColor,
pub hovered: ThemeColor,
Expand Down
1 change: 1 addition & 0 deletions src/ui/tooltip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ pub enum TooltipSide {
}

#[derive(Component, Reflect)]
#[reflect(Component)]
pub struct Tooltip {
pub text: String,
pub side: TooltipSide,
Expand Down

0 comments on commit 9dcca8c

Please sign in to comment.