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

Embed autotile assets #2402

Merged
merged 4 commits into from
Sep 9, 2021
Merged

Embed autotile assets #2402

merged 4 commits into from
Sep 9, 2021

Conversation

Geokureli
Copy link
Member

@Geokureli Geokureli commented Sep 8, 2021

Related to HaxeFlixel/flixel-demos#281

To Summarize: FlxGraphic.fromClass(GraphicAuto) results in a BitmapData of size 0x0 while it fetches the data asynchronously. When passed into a tilemap, no actual visible or solid tiles are created, this is why the EZPlatformer and SplitScreen demos don't work.

This change allows the autotile tilemaps to be used via "flixel/images/tile/autotiles.png". I plan to update the demos to do this if this is approved.

There may be other ways to fix this so people can use flixel's default autotile tilemaps. I don't know if there's some event that our demos could listen for before using the images, but I'd rather these demos avoid async listeners and look extremely simple to newcomers looking for snippets.

I don't know what effect this has on the export's file size to embed these images in every project. I assume they are already embedded via:@:keep @:bitmap. does this mean they are embedded twice? should we deprecate the @:bitmap classes?

@Geokureli
Copy link
Member Author

Geokureli commented Sep 8, 2021

export/html5/bin/ sizes (bytes):

Demo old new diff
EZPlatformer 1,698,964 1,688,383 -10,581
SplitScreen 1,700,575 1,689,993 -10,582

/shrug/

@Gama11
Copy link
Member

Gama11 commented Sep 8, 2021

It seems like it should be possible to just make the existing GraphicAuto etc classes work. For instance, we could try turning it into a private class _GraphicAuto that is extended by the GraphicAuto class visible to the user. That subclass could then probably set width / height in its constructor.

@Geokureli
Copy link
Member Author

I'll look into that, then. If we could avoid making people use arbitrary "flixel/images" paths than we should.

@Geokureli Geokureli marked this pull request as draft September 8, 2021 22:48
@Geokureli Geokureli marked this pull request as ready for review September 9, 2021 00:37
@Gama11 Gama11 merged commit e3c3b30 into HaxeFlixel:dev Sep 9, 2021
@Geokureli Geokureli deleted the autotile_asset branch January 24, 2022 20:31
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.

2 participants