Closed sumibi-yakitori closed 3 years ago
Thank you for the PR!
I noticed after merging that Shown
and Hidden
can't currently be triggered via Tetra's public API (other than Shown
getting fired once automatically at startup) - however, I needed to expose window visibility for #119, so I've done so in a seperate commit.
I'm not sure if I'm understanding what you're saying correctly, but on MacOS, minimizing and unminimizing a window seems to cause SDL_WINDOWEVENT_SHOWN
and SDL_WINDOWEVENT_HIDDEN
.
Ugh, that must be platform-specific, then, because it doesn't happen on Windows. I'll document that.
Ok.
I haven't checked how it works on Linux, but I think I can remove Shown
and Hidden
since my desire seems to be achieved if I can detect the minimization of a window and its unminimization.
Restored
, Maximized
, Minimized
These three events also occur on MacOS.
Yeah, I think I might remove them for now - the only consistent way to trigger them on all platforms seems to be to call SDL_ShowWindow
/SDL_HideWindow
(now exposed via tetra::window::set_visible
), but you don't need events to run code in response to that. The minimize/maximize/etc events are still super useful though 😄
And yep, those other three events work fine on Windows.
I am currently working on a tool that displays images from a large number of external files.
I need these events to unload textures from VRAM when the window is minimized. (This requires that
tetra::graphics::present
is called at least once in the tetra lifecycle after the user has released textures)