Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add easy way to load source assets rather than exported assets #2953

Open
Geokureli opened this issue Nov 3, 2023 · 3 comments · May be fixed by #2982
Open

Add easy way to load source assets rather than exported assets #2953

Geokureli opened this issue Nov 3, 2023 · 3 comments · May be fixed by #2982

Comments

@Geokureli
Copy link
Member

Geokureli commented Nov 3, 2023

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
Copy link
Member Author

Geokureli commented Nov 3, 2023

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

@Sword352
Copy link
Contributor

Sword352 commented Nov 3, 2023

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

@Geokureli
Copy link
Member Author

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 Geokureli linked a pull request Dec 12, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants