computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 6439e5d3355eab122694aaa6d41ec8ae89ea1303
parent a8b633b3160f906a67d57c7d62992fe986f43828
Author: Adam <1319733+freddyz@users.noreply.github.com>
Date:   Thu,  9 Apr 2020 19:00:38 -0500

Create drawFunctions.hpp
Diffstat:
Asrc/drawFunctions.hpp | 27+++++++++++++++++++++++++++
1 file changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/drawFunctions.hpp b/src/drawFunctions.hpp @@ -0,0 +1,27 @@ +#pragma once + +using namespace rack; + +struct DrawHelper { + + DrawArgs args; + DrawHelper(DrawArgs &someArgs) { + args = someArgs; + } + void drawOutline(std::vector<Vec> points,NVGColor color,float thickness) { + unsigned int n = points.size(); + nvgSave(args.vg); + nvgBeginPath(args.vg); + nvgStrokeStyle(args.vg,color); + nvgStrokeWidth(args.vg,thickness); + nvgMoveTo(args.vg,points[0].x,points[0].y); + + for(int i = 1; i < n; i++) { + nvgLineTo(args.vg,points[i].x,points[i].y); + } + + nvgClosePath(args.vg); + nvgStroke(args.vg); + nvgRestore(args.vg); + } +};