diff --git a/lvd_lib/src/objects/field_smash.rs b/lvd_lib/src/objects/field_smash.rs index a40146e..2616c5e 100644 --- a/lvd_lib/src/objects/field_smash.rs +++ b/lvd_lib/src/objects/field_smash.rs @@ -7,10 +7,10 @@ use serde::{Deserialize, Serialize}; use crate::{ id::Id, objects::{base::Base, region::Region}, - shape::{LvdPath, LvdShape2, LvdShape3}, + shape::{LvdPath, LvdShape2, LvdShape3, Rect}, string::LvdFixedString32, tag::Tag, - util::{Rect, Vector2}, + util::Vector2, version::{Version, Versioned}, }; diff --git a/lvd_lib/src/objects/region.rs b/lvd_lib/src/objects/region.rs index 9557c9e..6757916 100644 --- a/lvd_lib/src/objects/region.rs +++ b/lvd_lib/src/objects/region.rs @@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize}; use crate::{ objects::base::{Base, MetaInfo}, - util::Rect, + shape::Rect, version::{Version, Versioned}, }; diff --git a/lvd_lib/src/shape.rs b/lvd_lib/src/shape.rs index 5ad2d33..89897ab 100644 --- a/lvd_lib/src/shape.rs +++ b/lvd_lib/src/shape.rs @@ -1,7 +1,7 @@ //! Basic shape types. //! //! This module contains the [`LvdShape2`], [`LvdShape2Array`] and [`LvdShape2Element`] types, -//! the [`LvdShape3`] type, and the [`LvdPath`] type. +//! the [`LvdShape3`] type, the [`LvdPath`] type, and the [`Rect`] type. use binrw::binrw; #[cfg(feature = "serde")] @@ -237,3 +237,34 @@ impl Version for LvdPath { } } } + +/// A two-dimensional rectangle type. +#[binrw] +#[br(import(version: u8))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum Rect { + /// `Rect` version 1. + #[br(pre_assert(version == 1))] + V1 { + /// Coordinate of the left edge. + left: f32, + + /// Coordinate of the right edge. + right: f32, + + /// Coordinate of the top edge. + top: f32, + + /// Coordinate of the bottom edge. + bottom: f32, + }, +} + +impl Version for Rect { + fn version(&self) -> u8 { + match self { + Self::V1 { .. } => 1, + } + } +} diff --git a/lvd_lib/src/util.rs b/lvd_lib/src/util.rs index 462f6d8..182cd38 100644 --- a/lvd_lib/src/util.rs +++ b/lvd_lib/src/util.rs @@ -1,6 +1,6 @@ //! Basic vector types. //! -//! This module contains the [`Vector2`] and [`Vector3`] types as well as the [`Rect`] type. +//! This module contains the [`Vector2`] and [`Vector3`] types. use binrw::binrw; #[cfg(feature = "serde")] @@ -60,34 +60,3 @@ impl Version for Vector3 { } } } - -/// A two-dimensional rectangle type. -#[binrw] -#[br(import(version: u8))] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] -#[derive(Debug, Clone, Copy, PartialEq)] -pub enum Rect { - /// `Rect` version 1. - #[br(pre_assert(version == 1))] - V1 { - /// Coordinate of the left edge. - left: f32, - - /// Coordinate of the right edge. - right: f32, - - /// Coordinate of the top edge. - top: f32, - - /// Coordinate of the bottom edge. - bottom: f32, - }, -} - -impl Version for Rect { - fn version(&self) -> u8 { - match self { - Self::V1 { .. } => 1, - } - } -}