Tilengine - The 2D retro graphics engine forum
Release 2.7.0 - sprite list order, sprite masking - Printable Version

+- Tilengine - The 2D retro graphics engine forum (http://tilengine.org/forum)
+-- Forum: Tabloid (http://tilengine.org/forum/forumdisplay.php?fid=4)
+--- Forum: News & Announcements (http://tilengine.org/forum/forumdisplay.php?fid=6)
+--- Thread: Release 2.7.0 - sprite list order, sprite masking (/showthread.php?tid=561)



Release 2.7.0 - sprite list order, sprite masking - megamarc - 04-26-2020

Release 2.7.0 introduces two new features inspired on the Sega Genesis/MegaDrive and some tweaks & bugfixes

Sprite list order
Until now, sprites were drawn based in their order ID so when overlapping, sprite 0 was always under sprite 1, and sprite 2 was always on top of sprite 1. This release introduces the ability to change sprite ordering based on internal link list. Function TLN_SetFirstSprite() sets the index of the beggining of list, and TLN_SetNextSprite() tells which sprite follows which one. If you want that sprite 1 is drawn after sprite 4 (on top of it), you call TLN_SetNextSprite(4, 1).

Sprite masking
Now it's possible to define a horizontal region to mask out selected sprites with TLN_SetSpritesMaskRegion(top, bottom), setting a top and bottom scanline. Sprites flagged with TLN_EnableSpriteMasking() won't be drawn when crossing this region. The Sega Genesis had a cumbersome way to enable this feature, using specially positioned sprites on the screen and inside the sprite list order, but Tilengine does the same in a straightforward way.

Other tweaks and fixes include:
  • Fixes crashes when closing window and strange input behavior due to compiler-induced bugs with optimizations enabled for 64-bit builds
  • When CRT effect is disabled, sharp nearest-neighbour scaling is always used
  • Parameter "count" has been removed from TLN_CreateSpriteAnimation(), now is obtained automatically from sprite names inside spriteset.
  • Reworked some samples that used old and messy .sqx files for sprite animations, and replaced with newer spriteset-based sequences.
Check out in GitHub


RE: Release 2.7.0 - sprite list order, sprite masking - mycats - 04-28-2020

Hi again. Will you reimplement SetAnimationDelay()?


RE: Release 2.7.0 - sprite list order, sprite masking - megamarc - 04-28-2020

(04-28-2020, 01:38 AM)mycats Wrote: Hi again. Will you reimplement SetAnimationDelay()?
Maybe, why not? The issue here is to define conflicting behaviors. Each frame has its own delay, so what happens when you set a global delay? Does it override individual delays? And how do you return to standard per-frame delay? Maybe calling the function with a special value (like 0) that disables global delay?

If you make a small specification about desired behavior, of course it can be implemented