Add reflect impls to IRect and URect (#9191)
# Objective This attempts to make the new IRect and URect structs in bevy_math more similar to the existing Rect struct. ## Solution Add reflect implementations for IRect and URect, since one already exists for Rect.
This commit is contained in:
parent
593bebf930
commit
bc8e2746d7
@ -9,7 +9,7 @@ use crate::{IVec2, Rect, URect};
|
||||
/// methods instead, which will ensure this invariant is met, unless you already have
|
||||
/// the minimum and maximum corners.
|
||||
#[repr(C)]
|
||||
#[derive(Default, Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct IRect {
|
||||
/// The minimum corner point of the rect.
|
||||
|
||||
@ -9,7 +9,7 @@ use crate::{IRect, Rect, UVec2};
|
||||
/// methods instead, which will ensure this invariant is met, unless you already have
|
||||
/// the minimum and maximum corners.
|
||||
#[repr(C)]
|
||||
#[derive(Default, Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct URect {
|
||||
/// The minimum corner point of the rect.
|
||||
|
||||
@ -1,9 +1,18 @@
|
||||
use crate as bevy_reflect;
|
||||
use crate::prelude::ReflectDefault;
|
||||
use crate::{ReflectDeserialize, ReflectSerialize};
|
||||
use bevy_math::{Rect, Vec2};
|
||||
use bevy_math::{IRect, IVec2, Rect, URect, UVec2, Vec2};
|
||||
use bevy_reflect_derive::impl_reflect_struct;
|
||||
|
||||
impl_reflect_struct!(
|
||||
#[reflect(Debug, PartialEq, Hash, Serialize, Deserialize, Default)]
|
||||
#[type_path = "bevy_math"]
|
||||
struct IRect {
|
||||
min: IVec2,
|
||||
max: IVec2,
|
||||
}
|
||||
);
|
||||
|
||||
impl_reflect_struct!(
|
||||
#[reflect(Debug, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[type_path = "bevy_math"]
|
||||
@ -12,3 +21,12 @@ impl_reflect_struct!(
|
||||
max: Vec2,
|
||||
}
|
||||
);
|
||||
|
||||
impl_reflect_struct!(
|
||||
#[reflect(Debug, PartialEq, Hash, Serialize, Deserialize, Default)]
|
||||
#[type_path = "bevy_math"]
|
||||
struct URect {
|
||||
min: UVec2,
|
||||
max: UVec2,
|
||||
}
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user