From 488c7ed94b0662222fa0d825ab81b60b0b1e5d6c Mon Sep 17 00:00:00 2001 From: Micha White Date: Mon, 1 Jan 2024 19:41:32 -0500 Subject: Created a texture packer --- packer/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'packer/src/lib.rs') diff --git a/packer/src/lib.rs b/packer/src/lib.rs index 06c66ae..328f90e 100644 --- a/packer/src/lib.rs +++ b/packer/src/lib.rs @@ -1,5 +1,6 @@ +use std::collections::HashMap; +use std::ops::Deref; use std::sync::Arc; -use std::{collections::HashMap, ops::Deref}; use exun::RawUnexpected; use image::{GenericImage, RgbImage}; @@ -92,6 +93,7 @@ impl RectanglePacker { let mut rectangles = Vec::with_capacity(self.textures.len()); self.textures.sort(); + self.textures.reverse(); for texture in &self.textures { // loop to the next row if we've gone off the edge if (x_position + texture.0.width()) > image_width { -- cgit v1.2.3