|
import java.util.ArrayList;
public class BinPackerList
{
ArrayList<BinPacker> listBinPacker = new ArrayList<BinPacker>();
void add(BinPacker binPacker)
{
listBinPacker.add(binPacker);
}
BinPacker get(int index)
{
return listBinPacker.get(index);
}
int size()
{
return listBinPacker.size();
}
public void pack(ArrayList<AtlasImage> listImage)
{
int ixImage, n;
boolean added;
for (ixImage = listImage.size()-1; ixImage >= 0; ixImage--)
{
added = false;
for (n = 0; n < listBinPacker.size(); n++)
{
if (listBinPacker.get(n).add(listImage.get(ixImage)))
{
added = true;
listImage.remove(ixImage);
break;
}
}
if (!added) break;
}
// listImage.subList(0, ixImage).clear();
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
After working in the software industry for many years, I've started my own
games company that specialises in strategy games for mobile platforms.