upgrade rectangle pack (#673)
This commit is contained in:
parent
5e7c36d1c1
commit
df64e1fc92
@ -1,4 +1,5 @@
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
fmt::Debug,
|
||||
hash::{Hash, Hasher},
|
||||
};
|
||||
@ -13,7 +14,9 @@ pub(crate) const DEFAULT_HANDLE_ID: HandleId =
|
||||
HandleId(Uuid::from_u128(240940089166493627844978703213080810552));
|
||||
|
||||
/// A unique id that corresponds to a specific asset in the [Assets](crate::Assets) collection.
|
||||
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Serialize, Deserialize, Property)]
|
||||
#[derive(
|
||||
Debug, Clone, Copy, Eq, PartialOrd, Ord, PartialEq, Hash, Serialize, Deserialize, Property,
|
||||
)]
|
||||
pub struct HandleId(pub Uuid);
|
||||
|
||||
impl HandleId {
|
||||
@ -133,6 +136,18 @@ impl<T> PartialEq for Handle<T> {
|
||||
|
||||
impl<T> Eq for Handle<T> {}
|
||||
|
||||
impl<T> PartialOrd for Handle<T> {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
Some(self.id.cmp(&other.id))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Ord for Handle<T> {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
self.id.cmp(&other.id)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Debug for Handle<T> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
|
||||
let name = std::any::type_name::<T>().split("::").last().unwrap();
|
||||
|
@ -25,6 +25,6 @@ bevy_type_registry = { path = "../bevy_type_registry", version = "0.2.1" }
|
||||
bevy_utils = { path = "../bevy_utils", version = "0.2.1" }
|
||||
|
||||
# other
|
||||
rectangle-pack = "0.1"
|
||||
rectangle-pack = "0.2"
|
||||
thiserror = "1.0"
|
||||
guillotiere = "0.6.0"
|
||||
|
@ -89,7 +89,7 @@ impl TextureAtlasBuilder {
|
||||
rect_placements = None;
|
||||
break;
|
||||
}
|
||||
let mut target_bins = std::collections::HashMap::new();
|
||||
let mut target_bins = std::collections::BTreeMap::new();
|
||||
target_bins.insert(0, TargetBin::new(current_width, current_height, 1));
|
||||
atlas_texture = Texture::new_fill(
|
||||
Vec2::new(current_width as f32, current_height as f32),
|
||||
|
Loading…
Reference in New Issue
Block a user