2023-12-12 12:21:53 +00:00
|
|
|
use bevy::prelude::*;
|
|
|
|
|
|
|
|
#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)]
|
|
|
|
#[reflect(Component)]
|
2024-02-07 13:07:17 +00:00
|
|
|
struct TupleTestF32(f32);
|
2023-12-12 12:21:53 +00:00
|
|
|
|
|
|
|
#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)]
|
|
|
|
#[reflect(Component)]
|
2024-02-07 13:07:17 +00:00
|
|
|
struct TupleTestU64(u64);
|
2023-12-12 12:21:53 +00:00
|
|
|
|
|
|
|
#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)]
|
|
|
|
#[reflect(Component)]
|
2024-02-07 13:07:17 +00:00
|
|
|
pub struct TupleTestStr(String);
|
2023-12-12 12:21:53 +00:00
|
|
|
|
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
|
|
|
#[reflect(Component)]
|
2024-02-07 13:07:17 +00:00
|
|
|
struct TupleTest2(f32, u64, String);
|
2023-12-12 12:21:53 +00:00
|
|
|
|
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
|
|
|
#[reflect(Component)]
|
2024-02-07 13:07:17 +00:00
|
|
|
struct TupleTestBool(bool);
|
2023-12-12 12:21:53 +00:00
|
|
|
|
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
|
|
|
#[reflect(Component)]
|
2024-02-07 13:07:17 +00:00
|
|
|
struct TupleVec2(Vec2);
|
2023-12-12 12:21:53 +00:00
|
|
|
|
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
|
|
|
#[reflect(Component)]
|
2024-02-07 13:07:17 +00:00
|
|
|
struct TupleVec3(Vec3);
|
2023-12-12 12:21:53 +00:00
|
|
|
|
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
|
|
|
#[reflect(Component)]
|
2024-02-07 13:07:17 +00:00
|
|
|
struct TupleVec(Vec<String>);
|
2023-12-12 12:21:53 +00:00
|
|
|
|
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
|
|
|
#[reflect(Component)]
|
2024-02-07 13:07:17 +00:00
|
|
|
struct TupleTestColor(Color);
|
2023-12-12 12:21:53 +00:00
|
|
|
|
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
|
|
|
#[reflect(Component)]
|
|
|
|
struct BasicTest {
|
|
|
|
a: f32,
|
|
|
|
b: u64,
|
|
|
|
c: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
|
|
|
#[reflect(Component)]
|
|
|
|
pub enum EnumTest {
|
|
|
|
Metal,
|
|
|
|
Wood,
|
|
|
|
Rock,
|
|
|
|
Cloth,
|
|
|
|
Squishy,
|
|
|
|
#[default]
|
|
|
|
None,
|
|
|
|
}
|
|
|
|
|
2024-08-14 14:40:59 +00:00
|
|
|
pub struct ComponentsExamplesPlugin;
|
|
|
|
impl Plugin for ComponentsExamplesPlugin {
|
2023-12-12 12:21:53 +00:00
|
|
|
fn build(&self, app: &mut App) {
|
|
|
|
app.register_type::<BasicTest>()
|
2024-02-07 13:07:17 +00:00
|
|
|
.register_type::<TupleTestF32>()
|
|
|
|
.register_type::<TupleTestU64>()
|
|
|
|
.register_type::<TupleTestStr>()
|
|
|
|
.register_type::<TupleTestBool>()
|
|
|
|
.register_type::<TupleTest2>()
|
|
|
|
.register_type::<TupleVec2>()
|
|
|
|
.register_type::<TupleVec3>()
|
2023-12-12 12:21:53 +00:00
|
|
|
.register_type::<EnumTest>()
|
2024-02-07 13:07:17 +00:00
|
|
|
.register_type::<TupleTestColor>()
|
|
|
|
.register_type::<TupleVec>()
|
2023-12-12 12:21:53 +00:00
|
|
|
.register_type::<Vec<String>>();
|
|
|
|
}
|
|
|
|
}
|