Closed Voycawojka closed 4 months ago
Hi, due to the nature of immediate mode GUIs (ImGUI) such as Slab, it will be difficult to rely on callbacks/events like mousepressed
. What you can do, and what I did in my projects before, is you handle the IsVoidClicked
and IsVoidHovered
in your update, store the results in a variable, and use that in your callbacks. For the keyboard, you can do the same but use this event to check if a slab input is focused or not
Thanks, this is what I ended up doing. And the focus checking function is helpful. I must have missed it
Is there a way to check if an event (for example a mouse press) was consumed/handled by Slab? Let's say that players can select units by clicking on them with a mouse. What if a Slab window is occluding the unit? If I handle the selection like this:
...then the unit will be selected even though the player pressed on the UI window, not on the unit.
From what I understand by looking at the source code it's impossible to handle this case properly. But maybe I'm missing something?
I have found that I can use
IsVoidHovered
andIsVoidClicked
functions but there still are two problems:update
so I can't handle inputs with eventsIs there another way?