Example #1
0
 public bool Pack()
 {
     while (!TryPack())
     {
         if (height == width)
         {
             width *= 2;
         }
         else
         {
             height *= 2;
         }
         tree = new Space(0, 0, width, height);
     }
     return true;
 }
Example #2
0
 public bool Pack(int _width, int _height)
 {
     width = _width;
     height = _height;
     tree = new Space(0, 0, width, height);
     return TryPack();
 }
Example #3
0
 public SpritePacker(IEnumerable<Sprite> sprites)
 {
     GetSpriteSheetSize(sprites);
     tree = new Space(0, 0, width, height);
     this.sprites = sprites.OrderByDescending(sprite => sprite.Area).ToList();
 }