stefanmielke / libdragon-extensions

List of structs and functions to help on Libdragon development.
MIT License
6 stars 1 forks source link

Better Sprite Animation #8

Open stefanmielke opened 1 year ago

stefanmielke commented 1 year ago

We want to have better support for sprite animation. The current code we have in place is not really good for having multiple sprites in place.

Ideally we should have single and multiple spritesheet support, so that the same entity can have a single spritesheet with everything, or one spritesheets per animation it has.

A simple but decent animation system is anim8 for Love2d.

adamcate commented 1 year ago

Anim8 looks like a good start. Perhaps the function that initializes the grid for a given animation should have a sprite slot or sprite index associated with it, (as well as a pointer to the parent sprite_t) where the user can specify that this animation will be associated with this particular "sprite" (an example might be a player "sprite", which could have many animations associated with it, all having their own properties for playback rate and their own index. This would allow multiple animations with multiple sprite_t sources to be encoded with a dedicated sprite_t * per animation slot.

adamcate commented 1 year ago

If an animation frame is too big to fit into TMEM in one load, the system should also automatically do the necessary load and draw calls to get it on screen. This should also apply to the sprite batching functions, with new logic to ensure the minimum number of loads.

adamcate commented 1 year ago

The function should also automatically do the necessary set of loads and draw calls if the frame doesn't fit in 1 TMEM load.