ericoporto / ImGi

AGS Script Module for Immediate Gui (based on rxi's Microui)
https://www.adventuregamestudio.co.uk/forums/index.php?topic=58842.0
Other
2 stars 2 forks source link

Provide a Toast API #21

Open ericoporto opened 3 years ago

ericoporto commented 3 years ago

A Toast is a notification that shows up on screen with some content and then goes away, like a less fully featured notification - it has no interaction.

I am thinking about providing a ImGi.Toast but the idea here is to make it something you call only once instead of all the time.

I am also thinking I could use a different target for rendering this. So while we render all our things in a sprite target (at least, currently), the Toast could NOT use it, and instead happen on an Overlay on top. Of course, if the overlay below gets updated, we need to blow up and redraw later the overlay of Toast.

The idea I have is to give a small delay for Toast before it shows up. We use a offscreen Popup Window, have a few frames of it happen so we can know it's content, and then we just show it up, maybe with a Lerp so it looks nicer, and then we move it away. By doing something like Steam notifications, we can avoid relaying on transparency, which is not available yet for Overlays. Ideally, I would allow it to exist only on top left, top center, or top right, and it would come either from top, or from left or from the right, so default is the closer place but optionally you can force it being from top.

We need a either in/stay/out ticks or ms float. I am leaning for ticks for simplicity. We also need a message, a title (optional) and a icon (optional).

Right toasts are right aligned, left toasts are left aligned, and center toasts are center aligned.

We will draw from whatever is the style when Toast is called.

This will require a small stack to hold toasts, and we need to figure a way to pile toasts. Maybe either allowing only a very limited number like 3 to pile, or simply waiting for whatever the one on screen is over to show a new one.

This may run in an almost separate "engine" but I think it would be waste to draw on the screen sprite since it would not be interactive.