improved reactive ui and events

This commit is contained in:
2022-03-04 13:28:52 +01:00
parent 043d431e94
commit 46f03fbfe4
6 changed files with 128 additions and 57 deletions

15
src/lib/ui/UIEvents.hx Normal file
View File

@@ -0,0 +1,15 @@
package lib.ui;
import util.Vec.Vec2;
import kernel.ButtonType;
using tink.CoreApi;
typedef UIEvents = {
public var ?onClick:Callback<{button:ButtonType, pos:Vec2<Int>}>;
public var ?onKey:Callback<{keyCode:Int, isHeld:Bool}>;
public var ?onKeyUp:Callback<Int>;
public var ?onMouseDrag:Callback<{button:ButtonType, pos:Vec2<Int>}>;
public var ?onMouseScroll:Callback<{dir:Int, pos:Vec2<Int>}>;
public var ?onMouseUp:Callback<{button:ButtonType, pos:Vec2<Int>}>;
public var ?onPaste:Callback<String>;
}