34 lines
523 B
Haxe
34 lines
523 B
Haxe
package armory.logicnode;
|
|
|
|
import iron.system.Input;
|
|
|
|
class GetGamepadStartedNode extends LogicNode {
|
|
|
|
var buttonStarted: Null<String>;
|
|
|
|
public function new(tree: LogicTree) {
|
|
super(tree);
|
|
}
|
|
|
|
override function run(from: Int) {
|
|
var g = Input.getGamepad(inputs[0].get());
|
|
|
|
buttonStarted = null;
|
|
|
|
for (b in Gamepad.buttons) {
|
|
if (g.started(b)) {
|
|
buttonStarted = b;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (buttonStarted != null) {
|
|
runOutput(0);
|
|
}
|
|
}
|
|
|
|
override function get(from: Int) {
|
|
return buttonStarted;
|
|
}
|
|
}
|