Files
LNXSDK/leenkx/Sources/leenkx/logicnode/DrawArcNode.hx
2025-01-22 16:18:30 +01:00

41 lines
934 B
Haxe

package leenkx.logicnode;
import kha.Color;
import leenkx.renderpath.RenderToTexture;
#if lnx_ui
using zui.GraphicsExtension;
#end
class DrawArcNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
override function run(from: Int) {
#if lnx_ui
RenderToTexture.ensure2DContext("DrawArcNode");
final colorVec = inputs[1].get();
RenderToTexture.g.color = Color.fromFloats(colorVec.x, colorVec.y, colorVec.z, colorVec.w);
final segments = inputs[4].get();
final cx = inputs[5].get();
final cy = inputs[6].get();
final radius = inputs[7].get();
final sAngle = inputs[8].get();
final eAngle = inputs[9].get();
final ccw = inputs[10].get();
if (inputs[2].get()) {
RenderToTexture.g.fillArc(cx, cy, radius, sAngle, eAngle, ccw, segments);
} else {
RenderToTexture.g.drawArc(cx, cy, radius, sAngle, eAngle, inputs[3].get(), ccw, segments);
}
#end
runOutput(0);
}
}