2023-07-27 13:14:17 +00:00
|
|
|
use bevy::prelude::*;
|
|
|
|
|
2023-10-13 10:53:26 +00:00
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
2023-07-27 13:14:17 +00:00
|
|
|
#[reflect(Component)]
|
|
|
|
struct UnitTest;
|
|
|
|
|
|
|
|
#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)]
|
|
|
|
#[reflect(Component)]
|
|
|
|
struct TuppleTestF32(f32);
|
|
|
|
|
|
|
|
#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)]
|
|
|
|
#[reflect(Component)]
|
|
|
|
struct TuppleTestU64(u64);
|
|
|
|
|
|
|
|
#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)]
|
|
|
|
#[reflect(Component)]
|
|
|
|
pub struct TuppleTestStr(String);
|
|
|
|
|
2023-10-13 10:53:26 +00:00
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
2023-07-27 13:14:17 +00:00
|
|
|
#[reflect(Component)]
|
|
|
|
struct TuppleTest2(f32, u64, String);
|
|
|
|
|
2023-10-13 10:53:26 +00:00
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
2023-07-27 13:14:17 +00:00
|
|
|
#[reflect(Component)]
|
|
|
|
struct TuppleTestBool(bool);
|
|
|
|
|
2023-10-13 10:53:26 +00:00
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
2023-07-27 13:14:17 +00:00
|
|
|
#[reflect(Component)]
|
|
|
|
struct TuppleVec2(Vec2);
|
|
|
|
|
2023-10-13 10:53:26 +00:00
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
2023-07-27 13:14:17 +00:00
|
|
|
#[reflect(Component)]
|
|
|
|
struct TuppleVec3(Vec3);
|
|
|
|
|
2023-10-13 10:53:26 +00:00
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
2023-07-27 13:14:17 +00:00
|
|
|
#[reflect(Component)]
|
|
|
|
struct TuppleVec(Vec<String>);
|
|
|
|
|
2023-10-13 10:53:26 +00:00
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
2023-07-27 13:14:17 +00:00
|
|
|
#[reflect(Component)]
|
|
|
|
struct TuppleTestColor(Color);
|
|
|
|
|
2023-10-13 10:53:26 +00:00
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
2023-07-27 13:14:17 +00:00
|
|
|
#[reflect(Component)]
|
2023-10-13 10:53:26 +00:00
|
|
|
struct BasicTest {
|
2023-07-27 13:14:17 +00:00
|
|
|
a: f32,
|
|
|
|
b: u64,
|
2023-10-13 10:53:26 +00:00
|
|
|
c: String,
|
2023-07-27 13:14:17 +00:00
|
|
|
}
|
|
|
|
|
2023-10-13 10:53:26 +00:00
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
2023-07-27 13:14:17 +00:00
|
|
|
#[reflect(Component)]
|
2023-10-13 10:53:26 +00:00
|
|
|
pub enum EnumTest {
|
|
|
|
Metal,
|
|
|
|
Wood,
|
|
|
|
Rock,
|
|
|
|
Cloth,
|
|
|
|
Squishy,
|
|
|
|
#[default]
|
|
|
|
None,
|
2023-07-27 13:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub struct ComponentsTestPlugin;
|
|
|
|
impl Plugin for ComponentsTestPlugin {
|
2023-10-13 10:53:26 +00:00
|
|
|
fn build(&self, app: &mut App) {
|
|
|
|
app.register_type::<BasicTest>()
|
|
|
|
.register_type::<UnitTest>()
|
|
|
|
.register_type::<TuppleTestF32>()
|
|
|
|
.register_type::<TuppleTestU64>()
|
|
|
|
.register_type::<TuppleTestStr>()
|
|
|
|
.register_type::<TuppleTestBool>()
|
|
|
|
.register_type::<TuppleTest2>()
|
|
|
|
.register_type::<TuppleVec2>()
|
|
|
|
.register_type::<TuppleVec3>()
|
|
|
|
.register_type::<EnumTest>()
|
|
|
|
.register_type::<TuppleTestColor>()
|
|
|
|
.register_type::<TuppleVec>()
|
|
|
|
.register_type::<Vec<String>>();
|
|
|
|
}
|
2023-07-27 13:14:17 +00:00
|
|
|
}
|