Skip to content

Instantly share code, notes, and snippets.

@AxGord
Created February 24, 2016 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AxGord/ce5c654b18e19a8edbb8 to your computer and use it in GitHub Desktop.
Save AxGord/ce5c654b18e19a8edbb8 to your computer and use it in GitHub Desktop.
Asset managet example
/**
* ParentClass
* @author AxGord <axgord@gmail.com>
*/
@:assets_path('assets')
class ParentClass implements HasAsset {
@:asset public static var MY_ASSET = 'myasset3.png';
static function main() {
ParentClass.loadAllAssets(function(current:Int, total:Int) trace(current, total));
}
}
/**
* Child
* @author AxGord <axgord@gmail.com>
*/
@:assets_parent(ParentClass)
@:assets_path('example')
class Child implements HasAsset {
@:asset public static var MY_ASSET = 'myasset.png';
@:asset public static var MY_ASSET2 = 'myasset2.png';
@:asset('tile1.png') public static var MY_TILE1 = 'basetile.png';
@:asset('tile2.png') public static var MY_TILE2 = 'basetile.png';
@:asset('Font name') public static var MY_FONT = 'myfont.fnt';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment