focustense / StardewUI

UI/widget library for Stardew modding
MIT License
5 stars 1 forks source link

Overlay support in Framework API #17

Open focustense opened 2 weeks ago

focustense commented 2 weeks ago

Overlays are a feature of the Core library that is not supported in the Framework right now. They were originally intended mostly as an internal utility for custom widgets, but have certain uses in user UI, like menu stacks as an alternative to the fussy ChildMenu in vanilla.

I'm not sure what the API design might look like at this point. IOverlay is going to be more troublesome than the simplified IDrawable in #16. It's not a good candidate for directly passing over the API boundary for the same reasons as IView, but overlays exist as a stack with random access and it's not so simple to manipulate without access to the underlying types.

If all we need is Push and Pop, those can probably be implemented as API wrappers via PushAsset/PushMarkup and a Pop that simply returns a boolean or maybe an ID or something that can be proxied easily, just not the whole IOverlay.

Remove is much trickier. Maybe it can be handled by returning an IDisposable from Push.

OnClose is similarly finicky. I'm not sure how or if events work over Pintail. Maybe they are actually fine. Otherwise, maybe Push can accept a close callback.

These are just random thoughts and ideas for now. I'll update this when I have a clearer idea of how to make this accessible without making a big mess.

focustense commented 1 week ago

I think I'm going to punt this to a Beta 3. Most users will not need overlays, and Beta 2 has been largely focused on getting it into a widely usable and releasable state through better error handling, performance improvements, critical bug fixes, tooling and so on. This task still needs design work and would unnecessarily hold up the R2 release.