Esempio n. 1
0
void TexturePacker::pack()
{
    QString basepath = Project::getActiveProject().getImagePath();

    SpriteArray sprites, usedSprites;
    recurseDirectory(sprites, basepath);

    SpriteAtlas& atlas = Project::getActiveProject().getSpriteAtlas();
    atlas.clear();

    do
    {
        MaxRectsAlgorithm maxrects(2046, 2046);
        maxrects.insert(sprites, usedSprites);

        if ( !usedSprites.isEmpty() )
        {
            SpriteSheet sheet = createSpriteSheet(usedSprites);
            atlas.append(qMove(sheet));

            usedSprites.clear();
        }
    }
    while ( !sprites.isEmpty() );

    atlas.save(Project::getActiveProject().getTileAtlasPath());
}
Esempio n. 2
0
uint32_t CB_SpriteSheet::createSpriteSheet(string name)
{
    uint32_t id = createSpriteSheet();
    strToSheetMap[name] = id;
    return id;
}