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 FlxG.assets #2982

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

add FlxG.assets #2982

wants to merge 2 commits into from

Conversation

Geokureli
Copy link
Member

@Geokureli Geokureli commented Dec 12, 2023

still needs testing

Fixes #2953

Conflicts with #2949 will need to fix whichever is merged second

@moxie-coder
Copy link
Contributor

if I’m being honest, this is a very good change since it helps reduce imports (removing the need for openfl.utils.Assets) and makes code cleaner in general, so I like this so far

@Geokureli Geokureli added this to the 5.6.0 milestone Dec 13, 2023
@Geokureli Geokureli modified the milestones: 5.6.0, 5.7.0 Feb 2, 2024
@T1mL3arn
Copy link
Contributor

There is some problem with async text/binary assets. They are not cached by lime. This can lead to inconsistencies between html5 and sys targets: a user expects to get the cached asset with FlxG.assets.getText('atlas.json', true) but instead receives error asset "atlas.json" exists, but only asynchronously.

// Project.xml
<assets path="assets" embed="false" preload="false"/>

// Main.hx
openfl.Assets.loadText(AssetPaths.atlas__json).onComplete(json -> {
    // error on html5 "asset "atlas.json" exists, but only asynchronously"
    trace(openfl.Assets.getText(AssetPaths.atlas__json));
});

Possible solutions:

  • use the same cache rules for text/binary as lime does - no useCache param for getText() getJson() etc
  • flixel maintains its own text/binary cache for non sys targets (sys targets treat any asset as local, so such asset is read from file system when it's not cached)
  • make Lime team to implement cache for text/binary

@Geokureli
Copy link
Member Author

Geokureli commented Feb 10, 2024

There is some problem with async text/binary assets. They are not cached by lime.

The purpose of this PR is to add the ability to override the functionality of how flixel loads assets from string paths, I created FlxG.assets as an easy place to find this feature (and perhaps various other asset related features).

What you're describing seems like a separate feature related to flixel's asset system, which may or may not be implemented regardless of whether this PR is merged. Do you agree? If so, I would make a new issue, if not, I may need you to elaborate, cuz I'm not seeing the relevance

@T1mL3arn
Copy link
Contributor

I may need you to elaborate

At brief look this pr api suggest text/binary assets can be cached, but in fact - they are not. May be it should be more clear in doc about that.

a separate feature related to flixel's asset system, which may or may not be implemented regardless of whether this PR is merged. Do you agree?

I am kinda agree. This pr fits for text/binary asset cache feature in a way that without new asset front-end it's hard to implement the feature.

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 this pull request may close these issues.

Add easy way to load source assets rather than exported assets
3 participants