private void combineBoxes(SpriteBox initial, SpriteBox current, double width, double height) { if (width > mySpriteSize) { SpriteBox next = nearestBox(current.getX() + mySpriteSize, current.getY()); initial.combineWith(next); combineBoxes(initial, next, width - mySpriteSize, height); } if (height > mySpriteSize) { SpriteBox next = nearestBox(current.getX(), current.getY() + mySpriteSize); initial.combineWith(next); combineBoxes(initial, next, width, height - mySpriteSize); } }
private boolean checkAvailable(SpriteBox current, double width, double height) { if (!current.isAvailable()) { return false; } boolean bool1 = true; boolean bool2 = true; if (width > mySpriteSize) { SpriteBox next = nearestBox(current.getX() + mySpriteSize, current.getY()); bool1 = checkAvailable(next, width - mySpriteSize, height); } if (height > mySpriteSize && bool1) { SpriteBox nextBox = nearestBox(current.getX(), current.getY() + mySpriteSize); bool2 = checkAvailable(nextBox, width, height - mySpriteSize); } return bool1 && bool2; }