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