haxeui / haxeui-kha

The Kha backend of the HaxeUI framework -
http://haxeui.org
MIT License
45 stars 16 forks source link

inject input #56

Closed sh-dave closed 3 years ago

sh-dave commented 3 years ago

autoNotifyInput wasn't implemented, so i removed it and added a way to actually inject the input :smiley:

ianharrigan commented 3 years ago

Can you explain what this does? Im not 100% sure i follow.

sh-dave commented 3 years ago

Instead of always using kha.input.Mouse.get().notify(...) and kha.input.Keyboard.get().notify(...); the optional callbacks in the ToolkitOptions are used (un)subscribe listeners for these events now. By default, the implementation will fall back to using the old behavior if the callbacks are not provided. So it's possible to hook into the event system now in case i don't want haxeui to receive input events for some reason.

ianharrigan commented 3 years ago

Ah, OK, gotcha... I think i remember seeing something similar in ZUI... thanks! Will merge.

sh-dave commented 3 years ago

Zui has the ability to inject the events directly i.e. you call Zui.onMouseDown/Up/Move() by hand. But there were a lot of place in haxeui where you (un)listen to the events, so this was the easier way to get it done. If my usecases become more complicated i might think about implementing them differently, but for now this will do :sweat_smile: