diff options
| author | Arne Dußin | 2020-12-21 01:22:15 +0100 |
|---|---|---|
| committer | Arne Dußin | 2020-12-21 21:15:55 +0100 |
| commit | d7e9c3cc46d616c2fcd1a6e9f73adbb79c6570b4 (patch) | |
| tree | e5633f4d3b18472922c943d759e9f58722ba4405 /src/map/mappable.rs | |
| parent | 48f321a80970ebeb8374072b1d2e0a4d297aa348 (diff) | |
| download | graf_karto-d7e9c3cc46d616c2fcd1a6e9f73adbb79c6570b4.tar.gz graf_karto-d7e9c3cc46d616c2fcd1a6e9f73adbb79c6570b4.zip | |
Add previously missing docs where appropriate
Diffstat (limited to 'src/map/mappable.rs')
| -rw-r--r-- | src/map/mappable.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/map/mappable.rs b/src/map/mappable.rs index 323361a..7978f50 100644 --- a/src/map/mappable.rs +++ b/src/map/mappable.rs @@ -1,11 +1,12 @@ //! Something that's mappable can be placed on the map and drawn at a specific position. It has a -//! dimension on the map and may be scaleable +//! dimension on the map and may be transformable in various ways. use crate::math::Rect; use crate::transform::Transform; use crate::transformable::NonRigidTransformable; use raylib::drawing::RaylibDrawHandle; +/// Anything that can be added to the map or world must implement this trait. pub trait Mappable { /// Draw this to `rld` with the transform. An item that cannot be drawn is not mappable, so /// this must always be implemented. @@ -21,10 +22,13 @@ pub trait Mappable { /// Get the rectangle that contains the mappable object in its entirety without excess. fn bounding_rect(&self) -> Rect<f64>; + /// If this mappable item can be transformed in a non-rigid way, a dynamic reference is returned, + /// otherwise none. fn as_non_rigid(&self) -> Option<&dyn NonRigidTransformable> { None } + /// The same as `as_non_rigid`, but mutably. fn as_non_rigid_mut(&mut self) -> Option<&mut dyn NonRigidTransformable> { None } |
