Static variables

@:value(new BlobList())staticblobs:BlobList = new BlobList()

staticread onlyfontFormats:Array<String>

@:value(new FontList())staticfonts:FontList = new FontList()

staticread onlyimageFormats:Array<String>

@:value(new ImageList())staticimages:ImageList = new ImageList()


Moves from 0 to 1. Use for loading screens.

staticread onlysoundFormats:Array<String>

@:value(new SoundList())staticsounds:SoundList = new SoundList()

staticread onlyvideoFormats:Array<String>

@:value(new VideoList())staticvideos:VideoList = new VideoList()

Static methods

staticloadBlob(name:String, done:Blob ‑> Void, ?failed:AssetError ‑> Void, ?pos:PosInfos):Void

staticloadBlobFromPath(path:String, done:Blob ‑> Void, ?failed:AssetError ‑> Void, ?pos:PosInfos):Void

@:value({ uncompressSoundsFilter : null, filter : null })staticloadEverything(callback:() ‑> Void, ?filter:Dynamic ‑> Bool, ?uncompressSoundsFilter:Dynamic ‑> Bool, ?failed:AssetError ‑> Void):Void

Loads all assets which were detected by khamake. When running khamake (doing so is Kha's standard build behavior) it creates a files.json in the build/{target}-resources directoy which contains information about all assets which were found.

The callback parameter is always called after loading, even when some or all assets had failures.

An optional callback parameter failed is called for each asset that failed to load.

The filter parameter can be used to load assets selectively. The Dynamic parameter describes the asset, it contains the very same objects which are listed in files.json.

Additionally by default all sounds are decompressed. The uncompressSoundsFilter can be used to avoid that. Uncompressed sounds can still be played using which is recommended for music.

staticloadFont(name:String, done:Font ‑> Void, ?failed:AssetError ‑> Void, ?pos:PosInfos):Void

staticloadFontFromPath(path:String, done:Font ‑> Void, ?failed:AssetError ‑> Void, ?pos:PosInfos):Void

staticloadImage(name:String, done:Image ‑> Void, ?failed:AssetError ‑> Void, ?pos:PosInfos):Void

Loads an image by name which was preprocessed by khamake.



The name as defined by the khafile.


A callback.

staticloadImageFromPath(path:String, readable:Bool, done:Image ‑> Void, ?failed:AssetError ‑> Void, ?pos:PosInfos):Void

Loads an image from a path. Most targets support PNG and JPEG formats.



The path to the image file.


If true, a copy of the image will be kept in main memory for image read operations.


A callback.

staticloadSound(name:String, done:Sound ‑> Void, ?failed:AssetError ‑> Void, ?pos:PosInfos):Void

staticloadSoundFromPath(path:String, done:Sound ‑> Void, ?failed:AssetError ‑> Void, ?pos:PosInfos):Void

staticloadVideo(name:String, done:Video ‑> Void, ?failed:AssetError ‑> Void, ?pos:PosInfos):Void

staticloadVideoFromPath(path:String, done:Video ‑> Void, ?failed:AssetError ‑> Void, ?pos:PosInfos):Void

staticreporter(custom:AssetError ‑> Void, ?pos:PosInfos):AssetError ‑> Void