Changed Display from one sprite per cell to sprite stack per cell.#276
Changed Display from one sprite per cell to sprite stack per cell.#276marcojulian wants to merge 1 commit into
Conversation
|
Hey! I really appreciate the PR and this is a really common request, so all great there. I'm thinking more about where this fits into the broader library. I think it's kind of nice that the default display is dead simple, but I'd be totally willing to include this in spectrum as well as say StackedDisplay or somesuch. I'll do a deeper dive and give more feedback tomorrow or the next day hopefully. Thanks so much for your contribution! |
|
Also any idea how this plays with Animations? |
|
Of course! Please keep in mind that this is a late Sunday night solution so I know there could be room for improvement before merging. I didn't test it with animations since I haven't implemented any in my game yet. But I could add a couple and let you know how it goes! |
|
Discussed it in the discord with @fingoltin he's open to making this the default. |
|
After testing it out we do need a way to enable the current behaviour. Maybe we try subclassing? |
e1bdf33 to
8d0c620
Compare
|
✔️ I repeated the same manual tests that I shared above after replacing Display with StackedDisplay in my own main.lua |
|
This looks quite good. I have a few remaining questions: Where/if this breaks with the Display API? Will this mostly work drop in? Does it work with geometer? |
@MatthewBlanchard not sure I fully got the question, but:
Also I'm not jealous of my PR, if you feel the need to jump-in and tweak something feel free to do it 🙌 Otherwise please let me know if you have any other questions/concerns or want me to test anything else! |
|
Thank you! I think I've got it from here and this is going to be merged with a few minor changes! Thanks a ton. Should hit main this weekend. Different displays that are interchangeable, or for the most part, was actually one of our design goals we never really got time to do so thank you for helping us! |
|
I didn't think |
I looked at this. It's because of issues with the Display API. I suggest we accept this now and make changes to Display to make it easier to subclass. |




PR summary:
Displaynow supports layered sprites per cell, preserving terrain beneath transparent actor/item sprites while keeping existing depth ordering.Old behavior:
cell.charheld single tile.New behavior:
sprites = { ... }.put()appends sprite with depth/layer.draw()sorts cell sprites by depth and draws all.bgDepth, so sprite depth and bg depth no longer fight.clear()empties sprite stack each frame.Before:

After:
