You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's really common in other textmode/terminal games to pop up a window over top of other things currently on screen. More generally, I want to implement a concept of Regions being able to split into "layers", where you can have as many as you like, stacked on top of each other. Open questions;
What order are they drawn in?
Bottom to top: Probably the order most people will think in, most clearly reflects the "stacking"/"overlaying". Very convenient if you want the positions of things in higher layers to depend on the positions of things in lower ones.
Top to bottom: Enables passthrough much more easily (if a region is marked "empty", and input goes there, hand it over to the next layer; otherwise, don't) and potentially some pretty big optimizations (though actually implementing them will probably have to wait for Refactor UI #59); plus,
All at once; Probably really really hard to implement, at least in an efficient way. The closest I can get to imagining this is some sort of "mask" which records the height of the layer that last wrote to it and discards writes from lower layers, but... (a) that means a bunch of extra memory used, and (b) that's a lot of overhead to put on what would otherwise be a plain write. Plus, Action lifetimes suddenly become a much bigger pain to manage.
Can input "pass through" from a higher layer to a lower one?
Pro: Enables some neat UI things, e.g. being able to do "picture in picture" without actually blocking any UI elements
Caveat: You could already do a lot of this just with normal regions, and in particular, layers being per-region means you can always do a layer over one region and then your inputs to the side -- not the same but probably not half bad neither
Con: Letting input fall through pretty significantly increases the implementation complexity, and adds a couple potential footguns that would have to be mitigated/documented real carefully
Are there any handy optimizations we can enable?
e.g. if you use layers exclusively to implement modals without passthrough, maybe there should be a way to "save" the screen contents and then just re-render them as a "static image" below your top layer, or even as a background within it
this should already be possible with the included tools but it could be made much easier
What's the cleanest API to implement this? In particular, how can we avoid needing to resort to callback hell?
Something like let (layer: Region, rest: Region) = region.peel() might be doable (where lifetimes ensure that layer doesn't get used after peel starts getting touched, maybe, somehow?) but if layers are going to go in a fixed order, then it'll probably be important to ensure there's only one at a time, which is... complex
Maybe let (layer1: Region, rest: Rest) = region.peel(); let (layer2, rest) = rest.peel(); let final: Region = rest.top() so that the peel can avoid "containing a &mut", and only the layer / final do, preventing them from coexisting? is that possible?
Probably more that I just haven't thought of yet at 01:22 in the morning.
The text was updated successfully, but these errors were encountered:
It's really common in other textmode/terminal games to pop up a window over top of other things currently on screen. More generally, I want to implement a concept of Regions being able to split into "layers", where you can have as many as you like, stacked on top of each other. Open questions;
Action
lifetimes suddenly become a much bigger pain to manage.let (layer: Region, rest: Region) = region.peel()
might be doable (where lifetimes ensure thatlayer
doesn't get used afterpeel
starts getting touched, maybe, somehow?) but if layers are going to go in a fixed order, then it'll probably be important to ensure there's only one at a time, which is... complexlet (layer1: Region, rest: Rest) = region.peel(); let (layer2, rest) = rest.peel(); let final: Region = rest.top()
so that thepeel
can avoid "containing a&mut
", and only thelayer
/final
do, preventing them from coexisting? is that possible?The text was updated successfully, but these errors were encountered: