-
Notifications
You must be signed in to change notification settings - Fork 0
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
Using Heaps #1
Comments
Update: Based on recommendations from the Haxe Discord (thanks to @potatoelixir), I have updated my code to use private static function createTile(bytes:Bytes, width:Int, height:Int, colorDepth:ColorDepth):Tile {
var pixels = new Pixels(width, height, bytes, PixelFormat.RGBA);
return Tile.fromPixels(pixels);
} I'm no longer crashing, so I'm guessing something went right there. The RGBA pixel format is the only thing that worked properly, so I'm ignoring var tiles:Array<Tile> = [];
// var tiles = FOBSpriteSheet.gridFlatten(32);
Aseprite.parseFile(FOBSpriteBytes).frames.map(frame ->
frame.cels.map(cel -> tiles.push(cel.texture))
);
animation = new Anim(tiles, 15, s2d); I couldn't actually find any example in the wild of code that uses the |
Ok, interestingly enough, if I do this: Aseprite.parseFile(FOBSpriteBytes).frames.map(frame -> frame.cels.map(cel -> {
if (cel != null) {
trace('cel', cel.data.getParameters()[2]);
}
var tile = cast(cel.data.getParameters()[2], Tile);
tiles.push(tile);
return 0;
})); It actually renders! Not sure if grabbing the tile directly from the The robot on the top left was rendered from Manually setting tile size by doing |
I've made a working demo of using Aseprite stuff with Heaps. It's not exactly the most optimized or feature-rich, but it works, and you should be able to customize it however you want it. If this solves your problems, this issue should be closed :) |
Works great! Thanks again @potatoelixir! For anyone looking to use this for heaps in the future, now there's a clearly defined example for people to follow. 🎉 |
Heaps doesn't have textures from bytes, so I'm doing a bit of a workaround here.
I get back what seems like valid data, but I'm unsure how to get the underlying tiles to work. I'm left with
Error: Unsupported texture format
fromres.Any
trying to resolve it as anImage
.I have no idea how to create a texture from the bytes and set its textureFormat based on the colorDepth returned.
The text was updated successfully, but these errors were encountered: