flixel icon indicating copy to clipboard operation
flixel copied to clipboard

Add easy way to load source assets rather than exported assets

Open Geokureli opened this issue 2 years ago • 3 comments

This is becoming a very common request, people want to directly load the source assets rather than the exported assets, usually for dev purposes. For instance, it's easier to edit an asset and rerun the program (or clear the cache and reload assets) rather than recompiling the entire game every time you change an asset.

I'm proposing some sort of way to override the asset loader:

FlxG.assets.customLoadFunction = function(id:String, type:lime.utils.AssetType, useCache:Bool):Dynamic
{
    if (MyGameVars.useManifest)
        return lime.utils.getAsset(id, type, useCache);
    
    return MyGameUtils.loadFileFromDirectory(pathToSpecialDirectory, id, type, useCache);
}

Geokureli avatar Nov 03 '23 15:11 Geokureli

might also need some way for async loading vs sync loading. openfl asset utils typically have a getText and a loadText function

Geokureli avatar Nov 03 '23 15:11 Geokureli

Is there even an assets field in FlxG? I don't remember seeing something like that, and it would be probably better to add those in FlxAssets

Sword352 avatar Nov 03 '23 16:11 Sword352

Is there even an assets field in FlxG?

there is not, currently

it would be probably better to add those in FlxAssets

this statement directly conflicts with the point of #2951

Geokureli avatar Nov 03 '23 16:11 Geokureli