bevy/crates
Jerome Humbert 8b7b44d839 Move sprite::Rect into bevy_math (#5686)
# Objective

Promote the `Rect` utility of `sprite::Rect`, which defines a rectangle
by its minimum and maximum corners, to the `bevy_math` crate to make it
available as a general math type to all crates without the need to
depend on the `bevy_sprite` crate.

Fixes #5575

## Solution

Move `sprite::Rect` into `bevy_math` and fix all uses.

Implement `Reflect` for `Rect` directly into the `bevy_reflect` crate by
having `bevy_reflect` depend on `bevy_math`. This looks like a new
dependency, but the `bevy_reflect` was "cheating" for other math types
by directly depending on `glam` to reflect other math types, thereby
giving the illusion that there was no dependency on `bevy_math`. In
practice conceptually Bevy's math types are reflected into the
`bevy_reflect` crate to avoid a dependency of that crate to a "lower
level" utility crate like `bevy_math` (which in turn would make
`bevy_reflect` be a dependency of most other crates, and increase the
risk of circular dependencies). So this change simply formalizes that
dependency in `Cargo.toml`.

The `Rect` struct is also augmented in this change with a collection of
utility methods to improve its usability. A few uses cases are updated
to use those new methods, resulting is more clear and concise syntax.

---

## Changelog

### Changed

- Moved the `sprite::Rect` type into `bevy_math`.

### Added

- Added several utility methods to the `math::Rect` type.

## Migration Guide

The `bevy::sprite::Rect` type moved to the math utility crate as
`bevy::math::Rect`. You should change your imports from `use
bevy::sprite::Rect` to `use bevy::math::Rect`.
2022-09-02 12:35:23 +00:00
..
bevy_animation Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_app improve panic messages for add_system_to_stage and add_system_set_to_stage (#5847) 2022-09-02 12:18:44 +00:00
bevy_asset Add note on ordering to AssetServerSettings docs. (#5706) 2022-08-30 02:40:18 +00:00
bevy_audio Remove Sync requirement in Decodable::Decoder (#5819) 2022-08-29 23:02:12 +00:00
bevy_core Add missing type registrations for bevy_math types (#5758) 2022-08-23 21:19:29 +00:00
bevy_core_pipeline register missing reflect types (#5747) 2022-08-23 17:41:39 +00:00
bevy_derive Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_diagnostic Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
bevy_dylib Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_dynamic_plugin Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_ecs Add get_entity to Commands (#5854) 2022-09-01 22:06:46 +00:00
bevy_ecs_compile_fail_tests Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
bevy_encase_derive Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_gilrs Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_gltf Add associated constant IDENTITY to Transform and friends. (#5340) 2022-08-30 22:10:24 +00:00
bevy_hierarchy Remove duplicate asserts in test (#5648) 2022-08-15 23:03:42 +00:00
bevy_input Support for additional gamepad buttons and axis (#5853) 2022-09-02 02:16:18 +00:00
bevy_internal Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_log Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
bevy_macro_utils Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_math Move sprite::Rect into bevy_math (#5686) 2022-09-02 12:35:23 +00:00
bevy_mikktspace Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_pbr Add associated constant IDENTITY to Transform and friends. (#5340) 2022-08-30 22:10:24 +00:00
bevy_ptr Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_reflect Move sprite::Rect into bevy_math (#5686) 2022-09-02 12:35:23 +00:00
bevy_render Helpers to check pipeline cache status (#5796) 2022-09-02 12:18:43 +00:00
bevy_scene can clone a scene (#5855) 2022-09-02 11:56:21 +00:00
bevy_sprite Move sprite::Rect into bevy_math (#5686) 2022-09-02 12:35:23 +00:00
bevy_tasks Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_text register missing reflect types (#5747) 2022-08-23 17:41:39 +00:00
bevy_time Added the ability to get or set the last change tick of a system. (#5838) 2022-08-31 01:53:15 +00:00
bevy_transform Add associated constant IDENTITY to Transform and friends. (#5340) 2022-08-30 22:10:24 +00:00
bevy_ui Move sprite::Rect into bevy_math (#5686) 2022-09-02 12:35:23 +00:00
bevy_utils Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_window Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
bevy_winit Fix window centering when scale_factor is not 1.0 (#5582) 2022-08-30 20:13:38 +00:00