Skip to content

Texture Loader for Sprite Kit game engine. Textures and atlases creation including source images resizing.

Notifications You must be signed in to change notification settings

monofire/TextureLoader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TextureLoader

Texture loader for SpriteKit
Asynchronously cooks textures from bundle resources with source images.
Designed for cases when you don't want to use standard load mechanism from assets-folder.

Example

    /* Single textures collection example:
     get images from "assetsFolder/bolders" folder, scale down to 0.1 relative to screen height and create texture from each file */
    TLTexturesAssetBuilder *texturesAssetBuilder = [[TLTexturesAssetBuilder alloc]initWithBundleFolder:@"assetsFolder/bolders"
                                                                                      screenScaleRatio:0.1f
                                                                                                    of:SCREEN_HEIGHT];   
   /* Texture atlas example:
     get images from "assetsFolder/planets" folder, scale up to 1.2 relative to screen width and create texture atlas */
    TLTextureAtlasAssetBuilder *textureAtlasAssetBuilder = [[TLTextureAtlasAssetBuilder alloc]initWithBundleFolder:@"assetsFolder/planets"
                                                                                                  screenScaleRatio:1.2f
                                                                                                                of:SCREEN_WIDTH];
    
    /* Another texture atlas example:
     get images from "assetsFolder/ships" folder, scale down to 0.4 relative to screen height and create texture atlas */
    TLTextureAtlasAssetBuilder *textureAtlasAssetBuilderB = [[TLTextureAtlasAssetBuilder alloc]initWithBundleFolder:@"assetsFolder/ships"
                                                                                                   screenScaleRatio:0.4f
                                                                                                                 of:SCREEN_HEIGHT];
    
    /* load assets batch async */
    [loadDirector startLoadProcessWithAssetBuildersBatch:@[texturesAssetBuilder,textureAtlasAssetBuilder,textureAtlasAssetBuilderB]];


    /* load events */
   -(void)onAssetsBatchLoaded:(NSDictionary *)loadedAssets{
   
   }

   -(void) onAssetsLoadProgress: (CGFloat) assetsLoadProgress{
   
   }

Download example project

About

Texture Loader for Sprite Kit game engine. Textures and atlases creation including source images resizing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published