Page 1 of 1

GUI events

Posted: Thu Jul 06, 2017 1:07 am
by kumpu
Just a few suggestions to make the gui more powerful:

Extend on_gui_click by a position parameter, x and y relative to the clicked element. Not very useful for buttons etc, but for cameras there certainly are use cases.

Add on_gui_mouse_down, on_gui_mouse_up. Contains the same as on_gui_click + position.
Add on_gui_mouse_move. Contains element, player, position.

Add on_mouse_wheel. Contains the same as the above minus button. Obviously also contains wheel delta.

Please let me know what you think ;)

Re: GUI events

Posted: Sat Jul 08, 2017 3:30 pm
by doc
I would also really like a way to check what GUI element a player's cursor is currently over. I don't think this would be an event due to the network load that could cause, but some property like player.hovered_element (similar to player.selected) would be incredibly useful. I'd like to use this to show a custom details pane when mousing over certain items in lists.

Re: GUI events

Posted: Sun Jul 09, 2017 2:11 am
by Rseding91
A "hovered GUI element" would still need to send a network action every time the hovered element changed even when it wasn't being used since the GUI elements don't exist on anyones instance except the guy who sees them.

Re: GUI events

Posted: Sun Jul 09, 2017 4:39 pm
by kumpu
I see, so no event then. That's alright but the reason I brought this up is because I want to be able to control the camera gui elem by using the mouse. Just like the vanilla map view... So could you perhaps build that into the camera?
And what about the rest of the stuff I proposed?

Re: GUI events

Posted: Sun Jul 09, 2017 5:51 pm
by doc
Rseding91 wrote:A "hovered GUI element" would still need to send a network action every time the hovered element changed even when it wasn't being used since the GUI elements don't exist on anyones instance except the guy who sees them.
Is this particularly any more network load than updating the player.selected variable every time the player moves the cursor over a different game entity? Remember when hovering over the GUI there are no entities being selected.