armory/Sources/armory/logicnode/GetMouseStartedNode.hx

33 lines
500 B
Haxe
Raw Normal View History

2021-06-14 03:43:13 +02:00
package armory.logicnode;
import iron.system.Input;
2021-06-15 15:24:58 +02:00
class GetMouseStartedNode extends LogicNode {
2021-06-14 03:43:13 +02:00
var m = Input.getMouse();
var buttonStarted: Null<String>;
public function new(tree: LogicTree) {
super(tree);
}
override function run(from: Int) {
buttonStarted = null;
for (b in Mouse.buttons) {
if (m.started(b)) {
buttonStarted = b;
break;
}
}
if (buttonStarted != null) {
runOutput(0);
}
}
override function get(from: Int) {
return buttonStarted;
}
}