-
Notifications
You must be signed in to change notification settings - Fork 1
Input System
this section will cover everything there is to know about the input system of GNUI.
canvas serves as the root container handling all the input events and cursor movement for the entire tree, having every box do that would be a waste of resources. (actually thats how it used to work, but it made things alot messier)
Now, lets imagine our senario is the image bellow

first lets differenciate between each Input event in GNUI.
-
each box has its own
INPUTevent. and the event has its first parameter as an InputEvent -
every key press on your keyboard and mouse clicks and scrolls are handled by the InputEvent class.
-
only gets called if the cursor is on top of the box in question, so in the image above, this will only trigger for the blue box. because the cursor is on top of it.
-
returning
truewill stop the event from being handled. example of this being used is with theTextInputelement, clicking on it will make the every input event not trigger except for itself. unless you click away or confirm its input.
- this is the same as
Box.INPUTbut it will trigger regardles of where the cursor is. as long as its in the canvas.
- this is the same as
Box.INPUTbut will trigger when no box is on top of the cursor. and input events are triggered. - useful when you want to for example do something when the cursor is not on top of any UI elements.
- this event is triggered when the mouse moves within the confines of the box.
- its first parameter is a InputEventMouseMotion
- these events are triggered when the cursor enters and exits the confines of the box.
- this event is triggered when the state of the mouse to box interaction changes, arguments include:
(hovering: boolean, pressed: boolean)