VCV Rack API v2
Loading...
Searching...
No Matches
componentlibrary.hpp
Go to the documentation of this file.
1#pragma once
4#include <app/SvgKnob.hpp>
5#include <app/SvgSlider.hpp>
6#include <app/SvgPort.hpp>
8#include <app/SvgSwitch.hpp>
9#include <app/SvgScrew.hpp>
10#include <app/AudioDisplay.hpp>
11#include <app/MidiDisplay.hpp>
12#include <asset.hpp>
13
14
15namespace rack {
16
21namespace componentlibrary {
22
23
24using namespace window;
25
26
28// Color scheme
30
31static const NVGcolor SCHEME_BLACK_TRANSPARENT = nvgRGBA(0x00, 0x00, 0x00, 0x00);
32static const NVGcolor SCHEME_BLACK = nvgRGB(0x00, 0x00, 0x00);
33static const NVGcolor SCHEME_WHITE = nvgRGB(0xff, 0xff, 0xff);
34static const NVGcolor SCHEME_RED = nvgRGB(0xed, 0x2c, 0x24);
35static const NVGcolor SCHEME_ORANGE = nvgRGB(0xf2, 0xb1, 0x20);
36static const NVGcolor SCHEME_YELLOW = nvgRGB(0xff, 0xd7, 0x14);
37static const NVGcolor SCHEME_GREEN = nvgRGB(0x90, 0xc7, 0x3e);
38static const NVGcolor SCHEME_CYAN = nvgRGB(0x22, 0xe6, 0xef);
39static const NVGcolor SCHEME_BLUE = nvgRGB(0x29, 0xb2, 0xef);
40static const NVGcolor SCHEME_PURPLE = nvgRGB(0xd5, 0x2b, 0xed);
41static const NVGcolor SCHEME_LIGHT_GRAY = nvgRGB(0xe6, 0xe6, 0xe6);
42static const NVGcolor SCHEME_DARK_GRAY = nvgRGB(0x17, 0x17, 0x17);
43
44
46// Lights
48
49/*
50Many of these classes use CRTP (https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern).
51
52To use a red light with its default base class for example, use `RedLight` or `TRedLight<>`. (They are synonymous.)
53
54Use the `TBase` template argument if you want a different base class.
55E.g. `RectangleLight<RedLight>`
56
57Although this paradigm might seem confusing at first, it ends up being extremely simple in your plugin code and perfect for "decorating" your classes with appearance traits and behavioral properties.
58For example, need a slider with a green LED? Just use
59
60 createLightParamCentered<VCVLightSlider<GreenLight>>(...)
61*/
62
63template <typename TBase = app::ModuleLightWidget>
64struct TSvgLight : TBase {
67
70 this->addChild(fb);
71
73 fb->addChild(sw);
74 }
75
76 void setSvg(std::shared_ptr<Svg> svg) {
77 sw->setSvg(svg);
78 fb->box.size = sw->box.size;
79 this->box.size = sw->box.size;
80 }
81};
83
84template <typename TBase = app::ModuleLightWidget>
85struct TGrayModuleLightWidget : TBase {
87 this->bgColor = nvgRGBA(0x33, 0x33, 0x33, 0xff);
88 this->borderColor = nvgRGBA(0, 0, 0, 53);
89 }
90};
92
93template <typename TBase = GrayModuleLightWidget>
94struct TWhiteLight : TBase {
96 this->addBaseColor(SCHEME_WHITE);
97 }
98};
100
101template <typename TBase = GrayModuleLightWidget>
102struct TRedLight : TBase {
104 this->addBaseColor(SCHEME_RED);
105 }
106};
108
109template <typename TBase = GrayModuleLightWidget>
110struct TGreenLight : TBase {
112 this->addBaseColor(SCHEME_GREEN);
113 }
114};
116
117template <typename TBase = GrayModuleLightWidget>
118struct TBlueLight : TBase {
120 this->addBaseColor(SCHEME_BLUE);
121 }
122};
124
125template <typename TBase = GrayModuleLightWidget>
126struct TYellowLight : TBase {
128 this->addBaseColor(SCHEME_YELLOW);
129 }
130};
132
134template <typename TBase = GrayModuleLightWidget>
135struct TGreenRedLight : TBase {
137 this->addBaseColor(SCHEME_GREEN);
138 this->addBaseColor(SCHEME_RED);
139 }
140};
142
143template <typename TBase = GrayModuleLightWidget>
144struct TRedGreenBlueLight : TBase {
146 this->addBaseColor(SCHEME_RED);
147 this->addBaseColor(SCHEME_GREEN);
148 this->addBaseColor(SCHEME_BLUE);
149 }
150};
152
154template <typename TBase>
155struct LargeLight : TSvgLight<TBase> {
157 this->setSvg(Svg::load(asset::system("res/ComponentLibrary/LargeLight.svg")));
158 }
159};
160
162template <typename TBase>
163struct MediumLight : TSvgLight<TBase> {
165 this->setSvg(Svg::load(asset::system("res/ComponentLibrary/MediumLight.svg")));
166 }
167};
168
170template <typename TBase>
171struct SmallLight : TSvgLight<TBase> {
173 this->setSvg(Svg::load(asset::system("res/ComponentLibrary/SmallLight.svg")));
174 }
175};
176
178template <typename TBase>
179struct TinyLight : TSvgLight<TBase> {
181 this->setSvg(Svg::load(asset::system("res/ComponentLibrary/TinyLight.svg")));
182 }
183};
184
186template <typename TBase = GrayModuleLightWidget>
187struct LargeSimpleLight : TBase {
189 this->box.size = mm2px(math::Vec(5, 5));
190 }
191};
192
194template <typename TBase = GrayModuleLightWidget>
195struct MediumSimpleLight : TBase {
197 this->box.size = mm2px(math::Vec(3, 3));
198 }
199};
200
202template <typename TBase = GrayModuleLightWidget>
203struct SmallSimpleLight : TBase {
205 this->box.size = mm2px(math::Vec(2, 2));
206 }
207};
208
210template <typename TBase = GrayModuleLightWidget>
211struct TinySimpleLight : TBase {
213 this->box.size = mm2px(math::Vec(1, 1));
214 }
215};
216
217template <typename TBase>
218struct RectangleLight : TBase {
219 void drawBackground(const widget::Widget::DrawArgs& args) override {
220 // Derived from LightWidget::drawBackground()
221
222 nvgBeginPath(args.vg);
223 nvgRect(args.vg, 0, 0, this->box.size.x, this->box.size.y);
224
225 // Background
226 if (this->bgColor.a > 0.0) {
227 nvgFillColor(args.vg, this->bgColor);
228 nvgFill(args.vg);
229 }
230
231 // Border
232 if (this->borderColor.a > 0.0) {
233 nvgStrokeWidth(args.vg, 0.5);
234 nvgStrokeColor(args.vg, this->borderColor);
235 nvgStroke(args.vg);
236 }
237 }
238
239 void drawLight(const widget::Widget::DrawArgs& args) override {
240 // Derived from LightWidget::drawLight()
241
242 // Foreground
243 if (this->color.a > 0.0) {
244 nvgBeginPath(args.vg);
245 nvgRect(args.vg, 0, 0, this->box.size.x, this->box.size.y);
246
247 nvgFillColor(args.vg, this->color);
248 nvgFill(args.vg);
249 }
250 }
251};
252
254template <typename TBase>
255struct VCVBezelLight : TBase {
257 this->borderColor = color::BLACK_TRANSPARENT;
258 this->bgColor = color::BLACK_TRANSPARENT;
259 this->box.size = math::Vec(17.545, 17.545);
260 }
261};
262template <typename TBase>
264
267template <typename TBase>
268struct PB61303Light : TBase {
270 this->bgColor = color::BLACK_TRANSPARENT;
271 this->box.size = mm2px(math::Vec(9.0, 9.0));
272 }
273};
274
275
277// Knobs
279
282
284 minAngle = -0.83 * M_PI;
285 maxAngle = 0.83 * M_PI;
286
287 bg = new widget::SvgWidget;
289 }
290};
291
294 setSvg(Svg::load(asset::system("res/ComponentLibrary/RoundBlackKnob.svg")));
295 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/RoundBlackKnob_bg.svg")));
296 }
297};
298
301 setSvg(Svg::load(asset::system("res/ComponentLibrary/RoundSmallBlackKnob.svg")));
302 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/RoundSmallBlackKnob_bg.svg")));
303 }
304};
305
308 setSvg(Svg::load(asset::system("res/ComponentLibrary/RoundLargeBlackKnob.svg")));
309 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/RoundLargeBlackKnob_bg.svg")));
310 }
311};
312
315 setSvg(Svg::load(asset::system("res/ComponentLibrary/RoundBigBlackKnob.svg")));
316 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/RoundBigBlackKnob_bg.svg")));
317 }
318};
319
322 setSvg(Svg::load(asset::system("res/ComponentLibrary/RoundHugeBlackKnob.svg")));
323 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/RoundHugeBlackKnob_bg.svg")));
324 }
325};
326
329 snap = true;
330 }
331};
332
333
336
338 minAngle = -0.83 * M_PI;
339 maxAngle = 0.83 * M_PI;
340
341 bg = new widget::SvgWidget;
343 }
344};
345
348 setSvg(Svg::load(asset::system("res/ComponentLibrary/Davies1900hWhite.svg")));
349 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Davies1900hWhite_bg.svg")));
350 }
351};
352
355 setSvg(Svg::load(asset::system("res/ComponentLibrary/Davies1900hBlack.svg")));
356 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Davies1900hBlack_bg.svg")));
357 }
358};
359
362 setSvg(Svg::load(asset::system("res/ComponentLibrary/Davies1900hRed.svg")));
363 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Davies1900hRed_bg.svg")));
364 }
365};
366
369 setSvg(Svg::load(asset::system("res/ComponentLibrary/Davies1900hLargeWhite.svg")));
370 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Davies1900hLargeWhite_bg.svg")));
371 }
372};
373
376 setSvg(Svg::load(asset::system("res/ComponentLibrary/Davies1900hLargeBlack.svg")));
377 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Davies1900hLargeBlack_bg.svg")));
378 }
379};
380
383 setSvg(Svg::load(asset::system("res/ComponentLibrary/Davies1900hLargeRed.svg")));
384 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Davies1900hLargeRed_bg.svg")));
385 }
386};
387
388
392
394 minAngle = -0.83 * M_PI;
395 maxAngle = 0.83 * M_PI;
396
397 bg = new widget::SvgWidget;
399
400 fg = new widget::SvgWidget;
402 }
403};
404
407 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan6PSWhite.svg")));
408 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan6PS_bg.svg")));
409 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan6PSWhite_fg.svg")));
410 }
411};
412
415 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan5PSGray.svg")));
416 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan5PS_bg.svg")));
417 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan5PSGray_fg.svg")));
418 }
419};
420
423 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PSBlue.svg")));
424 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PS_bg.svg")));
425 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PSBlue_fg.svg")));
426 }
427};
428
431 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PSRed.svg")));
432 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PS_bg.svg")));
433 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PSRed_fg.svg")));
434 }
435};
436
439 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PSGreen.svg")));
440 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PS_bg.svg")));
441 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PSGreen_fg.svg")));
442 }
443};
444
447 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PSWhite.svg")));
448 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PS_bg.svg")));
449 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PSWhite_fg.svg")));
450 }
451};
452
455 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PBlue.svg")));
456 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3P_bg.svg")));
457 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PBlue_fg.svg")));
458 }
459};
460
463 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PRed.svg")));
464 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3P_bg.svg")));
465 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PRed_fg.svg")));
466 }
467};
468
471 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PGreen.svg")));
472 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3P_bg.svg")));
473 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PGreen_fg.svg")));
474 }
475};
476
479 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PWhite.svg")));
480 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3P_bg.svg")));
481 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan3PWhite_fg.svg")));
482 }
483};
484
487 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2SGray.svg")));
488 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2S_bg.svg")));
489 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2SGray_fg.svg")));
490 }
491};
492
495 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PSBlue.svg")));
496 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PS_bg.svg")));
497 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PSBlue_fg.svg")));
498 }
499};
500
503 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PSRed.svg")));
504 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PS_bg.svg")));
505 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PSRed_fg.svg")));
506 }
507};
508
511 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PSGreen.svg")));
512 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PS_bg.svg")));
513 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PSGreen_fg.svg")));
514 }
515};
516
519 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PSWhite.svg")));
520 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PS_bg.svg")));
521 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PSWhite_fg.svg")));
522 }
523};
524
527 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PBlue.svg")));
528 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2P_bg.svg")));
529 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PBlue_fg.svg")));
530 }
531};
532
535 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PRed.svg")));
536 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2P_bg.svg")));
537 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PRed_fg.svg")));
538 }
539};
540
543 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PGreen.svg")));
544 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2P_bg.svg")));
545 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PGreen_fg.svg")));
546 }
547};
548
551 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PWhite.svg")));
552 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2P_bg.svg")));
553 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan2PWhite_fg.svg")));
554 }
555};
556
559 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PSBlue.svg")));
560 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PS_bg.svg")));
561 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PSBlue_fg.svg")));
562 }
563};
564
567 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PSRed.svg")));
568 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PS_bg.svg")));
569 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PSRed_fg.svg")));
570 }
571};
572
575 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PSGreen.svg")));
576 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PS_bg.svg")));
577 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PSGreen_fg.svg")));
578 }
579};
580
583 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PSWhite.svg")));
584 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PS_bg.svg")));
585 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PSWhite_fg.svg")));
586 }
587};
588
591 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PBlue.svg")));
592 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1P_bg.svg")));
593 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PBlue_fg.svg")));
594 }
595};
596
599 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PRed.svg")));
600 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1P_bg.svg")));
601 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PRed_fg.svg")));
602 }
603};
604
607 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PGreen.svg")));
608 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1P_bg.svg")));
609 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PGreen_fg.svg")));
610 }
611};
612
615 setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PWhite.svg")));
616 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1P_bg.svg")));
617 fg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Rogan1PWhite_fg.svg")));
618 }
619};
620
621
624
626 minAngle = -0.82 * M_PI;
627 maxAngle = 0.82 * M_PI;
628
629 bg = new widget::SvgWidget;
631
632 setSvg(Svg::load(asset::system("res/ComponentLibrary/SynthTechAlco.svg")));
633 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/SynthTechAlco_bg.svg")));
634 }
635};
636
639
641 minAngle = -0.75 * M_PI;
642 maxAngle = 0.75 * M_PI;
643
644 bg = new widget::SvgWidget;
646
647 setSvg(Svg::load(asset::system("res/ComponentLibrary/Trimpot.svg")));
648 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/Trimpot_bg.svg")));
649 }
650};
651
654
656 minAngle = -0.75 * M_PI;
657 maxAngle = 0.75 * M_PI;
658 setSvg(Svg::load(asset::system("res/ComponentLibrary/BefacoBigKnob.svg")));
659
660 bg = new widget::SvgWidget;
662 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/BefacoBigKnob_bg.svg")));
663 }
664};
665
668
670 minAngle = -0.8 * M_PI;
671 maxAngle = 0.8 * M_PI;
672
673 bg = new widget::SvgWidget;
675
676 setSvg(Svg::load(asset::system("res/ComponentLibrary/BefacoTinyPointBlack.svg")));
677 bg->setSvg(Svg::load(asset::system("res/ComponentLibrary/BefacoTinyKnobWhite_bg.svg")));
678 }
679};
680
683 setBackgroundSvg(Svg::load(asset::system("res/ComponentLibrary/BefacoSlidePot.svg")));
684 setHandleSvg(Svg::load(asset::system("res/ComponentLibrary/BefacoSlidePotHandle.svg")));
685 math::Vec margin = math::Vec(3.5, 3.5);
686 setHandlePos(math::Vec(-1, 87).plus(margin), math::Vec(-1, -2).plus(margin));
687 background->box.pos = margin;
688 box.size = background->box.size.plus(margin.mult(2));
689 }
690};
691
694 setBackgroundSvg(Svg::load(asset::system("res/ComponentLibrary/VCVSlider.svg")));
695 setHandleSvg(Svg::load(asset::system("res/ComponentLibrary/VCVSliderHandle.svg")));
697 math::Vec(19.84260/2, 76.53517 - 11.74218/2),
698 math::Vec(19.84260/2, 0.0 + 11.74218/2)
699 );
700 }
701};
703
707template <typename TBase, typename TLightBase = RedLight>
708struct LightSlider : TBase {
710
712 light = new TLightBase;
713 this->addChild(light);
714 }
715
717 return light;
718 }
719
720 void step() override {
721 TBase::step();
722 // Move center of light to center of handle
723 light->box.pos = this->handle->box.pos
724 .plus(this->handle->box.size.div(2))
725 .minus(light->box.size.div(2));
726 }
727};
728
729template <typename TBase>
730struct VCVSliderLight : RectangleLight<TSvgLight<TBase>> {
732 this->setSvg(Svg::load(asset::system("res/ComponentLibrary/VCVSliderLight.svg")));
733 }
734};
735template <typename TBase>
737
738template <typename TLightBase = RedLight>
739struct VCVLightSlider : LightSlider<VCVSlider, VCVSliderLight<TLightBase>> {
741};
742template <typename TLightBase = RedLight>
744
746struct LEDSliderGreen : VCVLightSlider<GreenLight> {};
747struct LEDSliderRed : VCVLightSlider<RedLight> {};
748struct LEDSliderYellow : VCVLightSlider<YellowLight> {};
749struct LEDSliderBlue : VCVLightSlider<BlueLight> {};
750struct LEDSliderWhite : VCVLightSlider<WhiteLight> {};
751
752
754// Ports
756
759 setSvg(Svg::load(asset::system("res/ComponentLibrary/PJ301M.svg")));
760 }
761};
762
765 setSvg(Svg::load(asset::system("res/ComponentLibrary/PJ301M-dark.svg")));
766 }
767};
768
771 setSvg(Svg::load(asset::system("res/ComponentLibrary/PJ301M.svg")), Svg::load(asset::system("res/ComponentLibrary/PJ301M-dark.svg")));
772 }
773};
774
777 setSvg(Svg::load(asset::system("res/ComponentLibrary/PJ3410.svg")));
778 }
779};
780
783 setSvg(Svg::load(asset::system("res/ComponentLibrary/CL1362.svg")));
784 }
785};
786
787
789// Switches
791
792template <typename TSwitch>
793struct MomentarySwitch : TSwitch {
795 this->momentary = true;
796 }
797};
798
800 NKK() {
801 shadow->opacity = 0.0;
802 addFrame(Svg::load(asset::system("res/ComponentLibrary/NKK_0.svg")));
803 addFrame(Svg::load(asset::system("res/ComponentLibrary/NKK_1.svg")));
804 addFrame(Svg::load(asset::system("res/ComponentLibrary/NKK_2.svg")));
805 }
806};
807
810 shadow->opacity = 0.0;
811 addFrame(Svg::load(asset::system("res/ComponentLibrary/CKSS_0.svg")));
812 addFrame(Svg::load(asset::system("res/ComponentLibrary/CKSS_1.svg")));
813 }
814};
815
818 shadow->opacity = 0.0;
819 addFrame(Svg::load(asset::system("res/ComponentLibrary/CKSSThree_0.svg")));
820 addFrame(Svg::load(asset::system("res/ComponentLibrary/CKSSThree_1.svg")));
821 addFrame(Svg::load(asset::system("res/ComponentLibrary/CKSSThree_2.svg")));
822 }
823};
824
827 shadow->opacity = 0.0;
828 addFrame(Svg::load(asset::system("res/ComponentLibrary/CKSSThreeHorizontal_0.svg")));
829 addFrame(Svg::load(asset::system("res/ComponentLibrary/CKSSThreeHorizontal_1.svg")));
830 addFrame(Svg::load(asset::system("res/ComponentLibrary/CKSSThreeHorizontal_2.svg")));
831 }
832};
833
836 momentary = true;
837 addFrame(Svg::load(asset::system("res/ComponentLibrary/CKD6_0.svg")));
838 addFrame(Svg::load(asset::system("res/ComponentLibrary/CKD6_1.svg")));
839 }
840};
841
844 momentary = true;
845 addFrame(Svg::load(asset::system("res/ComponentLibrary/TL1105_0.svg")));
846 addFrame(Svg::load(asset::system("res/ComponentLibrary/TL1105_1.svg")));
847 }
848};
849
852 momentary = true;
853 addFrame(Svg::load(asset::system("res/ComponentLibrary/VCVButton_0.svg")));
854 addFrame(Svg::load(asset::system("res/ComponentLibrary/VCVButton_1.svg")));
855 }
856};
858
861 momentary = false;
862 latch = true;
863 }
864};
865
866template <typename TBase, typename TLight = WhiteLight>
867struct LightButton : TBase {
869
871 light = new TLight;
872 // Move center of light to center of box
873 light->box.pos = this->box.size.div(2).minus(light->box.size.div(2));
874 this->addChild(light);
875 }
876
878 return light;
879 }
880};
881
882template <typename TLight = WhiteLight>
884
886template <typename TLight>
888
889template <typename TLight>
892 this->momentary = false;
893 this->latch = true;
894 }
895};
896
899 addFrame(Svg::load(asset::system("res/ComponentLibrary/BefacoSwitch_0.svg")));
900 addFrame(Svg::load(asset::system("res/ComponentLibrary/BefacoSwitch_1.svg")));
901 addFrame(Svg::load(asset::system("res/ComponentLibrary/BefacoSwitch_2.svg")));
902 }
903};
904
907 momentary = true;
908 addFrame(Svg::load(asset::system("res/ComponentLibrary/BefacoPush_0.svg")));
909 addFrame(Svg::load(asset::system("res/ComponentLibrary/BefacoPush_1.svg")));
910 }
911};
912
915 momentary = true;
916 addFrame(Svg::load(asset::system("res/ComponentLibrary/VCVBezel.svg")));
917 }
918};
920
923 momentary = false;
924 latch = true;
925 }
926};
927
928template <typename TLightBase = WhiteLight>
931
934 // Move center of light to center of box
937 }
938
940 return light;
941 }
942};
943template <typename TLightBase = WhiteLight>
945
946template <typename TLightBase = WhiteLight>
947struct VCVLightBezelLatch : VCVLightBezel<TLightBase> {
949 this->momentary = false;
950 this->latch = true;
951 }
952};
953
956 momentary = true;
957 addFrame(Svg::load(asset::system("res/ComponentLibrary/PB61303.svg")));
958 }
959};
960
962// Misc
964
967 setSvg(Svg::load(asset::system("res/ComponentLibrary/ScrewSilver.svg")));
968 }
969};
970
973 setSvg(Svg::load(asset::system("res/ComponentLibrary/ScrewBlack.svg")));
974 }
975};
976
979 setSvg(Svg::load(asset::system("res/ComponentLibrary/ScrewSilver.svg")), Svg::load(asset::system("res/ComponentLibrary/ScrewBlack.svg")));
980 }
981};
982
983
985 int lightsLen = 0;
986 bool vertical = false;
987 float margin = mm2px(0.5);
988
989 void draw(const DrawArgs& args) override {
990 // Background
991 nvgBeginPath(args.vg);
992 nvgRect(args.vg, 0, 0, box.size.x, box.size.y);
993 nvgFillColor(args.vg, color::BLACK);
994 nvgFill(args.vg);
995 Widget::draw(args);
996 }
997
998 template <typename TLightBase = WhiteLight>
999 void setLights(engine::Module* module, int firstLightId, int lightsLen) {
1000 clearChildren();
1001 this->lightsLen = lightsLen;
1002 float r = (vertical ? box.size.y : box.size.x) - margin;
1003 for (int i = 0; i < lightsLen; i++) {
1004 float p = float(i) / lightsLen;
1006 if (vertical) {
1007 light->box.pos.y = p * r + margin;
1008 light->box.size.y = r / lightsLen - margin;
1009 light->box.size.x = box.size.x;
1010 }
1011 else {
1012 light->box.pos.x = p * r + margin;
1013 light->box.size.x = r / lightsLen - margin;
1014 light->box.size.y = box.size.y;
1015 }
1016 light->module = module;
1017 light->firstLightId = firstLightId;
1018 firstLightId += light->baseColors.size();
1019 addChild(light);
1020 }
1021 }
1022};
1023
1024
1027 addFrame(Svg::load(asset::system("res/ComponentLibrary/ADAT.svg")));
1028 shadow->opacity = 0.0;
1029 }
1030};
1031
1032
1035 addFrame(Svg::load(asset::system("res/ComponentLibrary/USB_B.svg")));
1036 shadow->opacity = 0.0;
1037 }
1038};
1039
1040
1043 addFrame(Svg::load(asset::system("res/ComponentLibrary/MIDI_DIN.svg")));
1044 shadow->opacity = 0.0;
1045 }
1046};
1047
1048
1049} // namespace componentlibrary
1050} // namespace rack
std::string system(std::string filename="")
Returns the path of a system asset.
static const NVGcolor BLACK
Definition color.hpp:17
static const NVGcolor BLACK_TRANSPARENT
Definition color.hpp:13
static const NVGcolor SCHEME_YELLOW
Definition componentlibrary.hpp:36
static const NVGcolor SCHEME_DARK_GRAY
Definition componentlibrary.hpp:42
static const NVGcolor SCHEME_WHITE
Definition componentlibrary.hpp:33
static const NVGcolor SCHEME_ORANGE
Definition componentlibrary.hpp:35
static const NVGcolor SCHEME_CYAN
Definition componentlibrary.hpp:38
static const NVGcolor SCHEME_PURPLE
Definition componentlibrary.hpp:40
static const NVGcolor SCHEME_GREEN
Definition componentlibrary.hpp:37
static const NVGcolor SCHEME_BLACK_TRANSPARENT
Definition componentlibrary.hpp:31
static const NVGcolor SCHEME_BLACK
Definition componentlibrary.hpp:32
static const NVGcolor SCHEME_RED
Definition componentlibrary.hpp:34
static const NVGcolor SCHEME_BLUE
Definition componentlibrary.hpp:39
static const NVGcolor SCHEME_LIGHT_GRAY
Definition componentlibrary.hpp:41
float mm2px(float mm)
Converts millimeter measurements to pixels.
Definition Svg.hpp:30
Root namespace for the Rack API.
Definition AudioDisplay.hpp:9
A virtual audio port graphic that displays an audio menu when clicked.
Definition AudioDisplay.hpp:60
float opacity
Definition CircularShadow.hpp:12
bool snap
Enables value snapping to the nearest integer.
Definition Knob.hpp:25
float maxAngle
Definition Knob.hpp:34
float minAngle
Angles in radians.
Definition Knob.hpp:33
NVGcolor borderColor
Definition LightWidget.hpp:13
NVGcolor bgColor
Definition LightWidget.hpp:11
A virtual MIDI port graphic that displays an MIDI menu when clicked.
Definition MidiDisplay.hpp:45
A MultiLightWidget that points to a module's Light or a range of lights Will access firstLightId,...
Definition ModuleLightWidget.hpp:15
int firstLightId
Definition ModuleLightWidget.hpp:20
std::vector< NVGcolor > baseColors
Colors of each value state.
Definition MultiLightWidget.hpp:13
void addBaseColor(NVGcolor baseColor)
CircularShadow * shadow
Definition SvgButton.hpp:15
void addFrame(std::shared_ptr< window::Svg > svg)
A knob which rotates an SVG and caches it in a framebuffer.
Definition SvgKnob.hpp:15
void setSvg(std::shared_ptr< window::Svg > svg)
widget::FramebufferWidget * fb
Definition SvgKnob.hpp:16
widget::TransformWidget * tw
Definition SvgKnob.hpp:18
Definition SvgPort.hpp:14
void setSvg(std::shared_ptr< window::Svg > svg)
If you don't add these to your ModuleWidget, they will fall out of the rack...
Definition SvgScrew.hpp:14
void setSvg(std::shared_ptr< window::Svg > svg)
Behaves like a knob but linearly moves an widget::SvgWidget between two points.
Definition SvgSlider.hpp:15
void setHandlePos(math::Vec minHandlePos, math::Vec maxHandlePos)
void setHandleSvg(std::shared_ptr< window::Svg > svg)
void setBackgroundSvg(std::shared_ptr< window::Svg > svg)
widget::SvgWidget * background
Definition SvgSlider.hpp:17
void setHandlePosCentered(math::Vec minHandlePosCentered, math::Vec maxHandlePosCentered)
A ParamWidget with multiple frames corresponding to its value.
Definition SvgSwitch.hpp:14
void addFrame(std::shared_ptr< window::Svg > svg)
Adds an SVG file to represent the next switch position.
CircularShadow * shadow
Definition SvgSwitch.hpp:19
bool latch
Use frames 0 and 1 when the mouse is pressed and released, instead of using the param value as the fr...
Definition SvgSwitch.hpp:25
bool momentary
Instead of incrementing values on each click, sets maxValue on press and minValue on release.
Definition Switch.hpp:21
Definition SvgPort.hpp:30
void setSvg(std::shared_ptr< window::Svg > lightSvg, std::shared_ptr< window::Svg > darkSvg)
Definition SvgPort.hpp:34
Definition SvgScrew.hpp:26
void setSvg(std::shared_ptr< window::Svg > lightSvg, std::shared_ptr< window::Svg > darkSvg)
Definition SvgScrew.hpp:30
Definition componentlibrary.hpp:1025
AudioButton_ADAT()
Definition componentlibrary.hpp:1026
Definition componentlibrary.hpp:1033
AudioButton_USB_B()
Definition componentlibrary.hpp:1034
Definition componentlibrary.hpp:652
widget::SvgWidget * bg
Definition componentlibrary.hpp:653
BefacoBigKnob()
Definition componentlibrary.hpp:655
Definition componentlibrary.hpp:905
BefacoPush()
Definition componentlibrary.hpp:906
Definition componentlibrary.hpp:681
BefacoSlidePot()
Definition componentlibrary.hpp:682
Definition componentlibrary.hpp:897
BefacoSwitch()
Definition componentlibrary.hpp:898
Definition componentlibrary.hpp:666
widget::SvgWidget * bg
Definition componentlibrary.hpp:667
BefacoTinyKnob()
Definition componentlibrary.hpp:669
Definition componentlibrary.hpp:834
CKD6()
Definition componentlibrary.hpp:835
Definition componentlibrary.hpp:825
CKSSThreeHorizontal()
Definition componentlibrary.hpp:826
Definition componentlibrary.hpp:816
CKSSThree()
Definition componentlibrary.hpp:817
Definition componentlibrary.hpp:808
CKSS()
Definition componentlibrary.hpp:809
Definition componentlibrary.hpp:781
CL1362Port()
Definition componentlibrary.hpp:782
Definition componentlibrary.hpp:763
DarkPJ301MPort()
Definition componentlibrary.hpp:764
Definition componentlibrary.hpp:353
Davies1900hBlackKnob()
Definition componentlibrary.hpp:354
Definition componentlibrary.hpp:334
Davies1900hKnob()
Definition componentlibrary.hpp:337
widget::SvgWidget * bg
Definition componentlibrary.hpp:335
Definition componentlibrary.hpp:374
Davies1900hLargeBlackKnob()
Definition componentlibrary.hpp:375
Definition componentlibrary.hpp:381
Davies1900hLargeRedKnob()
Definition componentlibrary.hpp:382
Definition componentlibrary.hpp:367
Davies1900hLargeWhiteKnob()
Definition componentlibrary.hpp:368
Definition componentlibrary.hpp:360
Davies1900hRedKnob()
Definition componentlibrary.hpp:361
Definition componentlibrary.hpp:346
Davies1900hWhiteKnob()
Definition componentlibrary.hpp:347
Definition componentlibrary.hpp:749
Deprecated.
Definition componentlibrary.hpp:746
Definition componentlibrary.hpp:747
Definition componentlibrary.hpp:750
Definition componentlibrary.hpp:748
Based on the size of 5mm LEDs.
Definition componentlibrary.hpp:155
LargeLight()
Definition componentlibrary.hpp:156
Based on the size of 5mm LEDs.
Definition componentlibrary.hpp:187
LargeSimpleLight()
Definition componentlibrary.hpp:188
Definition componentlibrary.hpp:867
LightButton()
Definition componentlibrary.hpp:870
app::ModuleLightWidget * light
Definition componentlibrary.hpp:868
app::ModuleLightWidget * getLight()
Definition componentlibrary.hpp:877
An SvgSlider with an attached light.
Definition componentlibrary.hpp:708
app::ModuleLightWidget * light
Definition componentlibrary.hpp:709
LightSlider()
Definition componentlibrary.hpp:711
void step() override
Definition componentlibrary.hpp:720
app::ModuleLightWidget * getLight()
Definition componentlibrary.hpp:716
Based on the size of 3mm LEDs.
Definition componentlibrary.hpp:163
MediumLight()
Definition componentlibrary.hpp:164
Based on the size of 3mm LEDs.
Definition componentlibrary.hpp:195
MediumSimpleLight()
Definition componentlibrary.hpp:196
Definition componentlibrary.hpp:1041
MidiButton_MIDI_DIN()
Definition componentlibrary.hpp:1042
Definition componentlibrary.hpp:793
MomentarySwitch()
Definition componentlibrary.hpp:794
Definition componentlibrary.hpp:799
NKK()
Definition componentlibrary.hpp:800
A light to displayed over PB61303.
Definition componentlibrary.hpp:268
PB61303Light()
Definition componentlibrary.hpp:269
Definition componentlibrary.hpp:954
PB61303()
Definition componentlibrary.hpp:955
Definition componentlibrary.hpp:757
PJ301MPort()
Definition componentlibrary.hpp:758
Definition componentlibrary.hpp:775
PJ3410Port()
Definition componentlibrary.hpp:776
Definition componentlibrary.hpp:218
void drawLight(const widget::Widget::DrawArgs &args) override
Definition componentlibrary.hpp:239
void drawBackground(const widget::Widget::DrawArgs &args) override
Definition componentlibrary.hpp:219
Definition componentlibrary.hpp:589
Rogan1PBlue()
Definition componentlibrary.hpp:590
Definition componentlibrary.hpp:605
Rogan1PGreen()
Definition componentlibrary.hpp:606
Definition componentlibrary.hpp:597
Rogan1PRed()
Definition componentlibrary.hpp:598
Definition componentlibrary.hpp:557
Rogan1PSBlue()
Definition componentlibrary.hpp:558
Definition componentlibrary.hpp:573
Rogan1PSGreen()
Definition componentlibrary.hpp:574
Definition componentlibrary.hpp:565
Rogan1PSRed()
Definition componentlibrary.hpp:566
Definition componentlibrary.hpp:581
Rogan1PSWhite()
Definition componentlibrary.hpp:582
Definition componentlibrary.hpp:613
Rogan1PWhite()
Definition componentlibrary.hpp:614
Definition componentlibrary.hpp:525
Rogan2PBlue()
Definition componentlibrary.hpp:526
Definition componentlibrary.hpp:541
Rogan2PGreen()
Definition componentlibrary.hpp:542
Definition componentlibrary.hpp:533
Rogan2PRed()
Definition componentlibrary.hpp:534
Definition componentlibrary.hpp:493
Rogan2PSBlue()
Definition componentlibrary.hpp:494
Definition componentlibrary.hpp:509
Rogan2PSGreen()
Definition componentlibrary.hpp:510
Definition componentlibrary.hpp:501
Rogan2PSRed()
Definition componentlibrary.hpp:502
Definition componentlibrary.hpp:517
Rogan2PSWhite()
Definition componentlibrary.hpp:518
Definition componentlibrary.hpp:549
Rogan2PWhite()
Definition componentlibrary.hpp:550
Definition componentlibrary.hpp:485
Rogan2SGray()
Definition componentlibrary.hpp:486
Definition componentlibrary.hpp:453
Rogan3PBlue()
Definition componentlibrary.hpp:454
Definition componentlibrary.hpp:469
Rogan3PGreen()
Definition componentlibrary.hpp:470
Definition componentlibrary.hpp:461
Rogan3PRed()
Definition componentlibrary.hpp:462
Definition componentlibrary.hpp:421
Rogan3PSBlue()
Definition componentlibrary.hpp:422
Definition componentlibrary.hpp:437
Rogan3PSGreen()
Definition componentlibrary.hpp:438
Definition componentlibrary.hpp:429
Rogan3PSRed()
Definition componentlibrary.hpp:430
Definition componentlibrary.hpp:445
Rogan3PSWhite()
Definition componentlibrary.hpp:446
Definition componentlibrary.hpp:477
Rogan3PWhite()
Definition componentlibrary.hpp:478
Definition componentlibrary.hpp:413
Rogan5PSGray()
Definition componentlibrary.hpp:414
Definition componentlibrary.hpp:405
Rogan6PSWhite()
Definition componentlibrary.hpp:406
Definition componentlibrary.hpp:389
widget::SvgWidget * bg
Definition componentlibrary.hpp:390
widget::SvgWidget * fg
Definition componentlibrary.hpp:391
Rogan()
Definition componentlibrary.hpp:393
Definition componentlibrary.hpp:313
RoundBigBlackKnob()
Definition componentlibrary.hpp:314
Definition componentlibrary.hpp:292
RoundBlackKnob()
Definition componentlibrary.hpp:293
Definition componentlibrary.hpp:327
RoundBlackSnapKnob()
Definition componentlibrary.hpp:328
Definition componentlibrary.hpp:320
RoundHugeBlackKnob()
Definition componentlibrary.hpp:321
Definition componentlibrary.hpp:280
RoundKnob()
Definition componentlibrary.hpp:283
widget::SvgWidget * bg
Definition componentlibrary.hpp:281
Definition componentlibrary.hpp:306
RoundLargeBlackKnob()
Definition componentlibrary.hpp:307
Definition componentlibrary.hpp:299
RoundSmallBlackKnob()
Definition componentlibrary.hpp:300
Definition componentlibrary.hpp:971
ScrewBlack()
Definition componentlibrary.hpp:972
Definition componentlibrary.hpp:965
ScrewSilver()
Definition componentlibrary.hpp:966
Definition componentlibrary.hpp:984
void setLights(engine::Module *module, int firstLightId, int lightsLen)
Definition componentlibrary.hpp:999
float margin
Definition componentlibrary.hpp:987
int lightsLen
Definition componentlibrary.hpp:985
void draw(const DrawArgs &args) override
Draws the widget to the NanoVG context.
Definition componentlibrary.hpp:989
bool vertical
Definition componentlibrary.hpp:986
Based on the size of 2mm LEDs.
Definition componentlibrary.hpp:171
SmallLight()
Definition componentlibrary.hpp:172
Based on the size of 2mm LEDs.
Definition componentlibrary.hpp:203
SmallSimpleLight()
Definition componentlibrary.hpp:204
Definition componentlibrary.hpp:622
SynthTechAlco()
Definition componentlibrary.hpp:625
widget::SvgWidget * bg
Definition componentlibrary.hpp:623
Definition componentlibrary.hpp:118
TBlueLight()
Definition componentlibrary.hpp:119
Definition componentlibrary.hpp:85
TGrayModuleLightWidget()
Definition componentlibrary.hpp:86
Definition componentlibrary.hpp:110
TGreenLight()
Definition componentlibrary.hpp:111
Reads two adjacent lightIds, so lightId and lightId + 1 must be defined.
Definition componentlibrary.hpp:135
TGreenRedLight()
Definition componentlibrary.hpp:136
Definition componentlibrary.hpp:842
TL1105()
Definition componentlibrary.hpp:843
Definition componentlibrary.hpp:144
TRedGreenBlueLight()
Definition componentlibrary.hpp:145
Definition componentlibrary.hpp:102
TRedLight()
Definition componentlibrary.hpp:103
Definition componentlibrary.hpp:64
widget::SvgWidget * sw
Definition componentlibrary.hpp:66
widget::FramebufferWidget * fb
Definition componentlibrary.hpp:65
void setSvg(std::shared_ptr< Svg > svg)
Definition componentlibrary.hpp:76
TSvgLight()
Definition componentlibrary.hpp:68
Definition componentlibrary.hpp:94
TWhiteLight()
Definition componentlibrary.hpp:95
Definition componentlibrary.hpp:126
TYellowLight()
Definition componentlibrary.hpp:127
Definition componentlibrary.hpp:769
ThemedPJ301MPort()
Definition componentlibrary.hpp:770
Definition componentlibrary.hpp:977
ThemedScrew()
Definition componentlibrary.hpp:978
Based on the size of 1mm LEDs.
Definition componentlibrary.hpp:179
TinyLight()
Definition componentlibrary.hpp:180
Based on the size of 1mm LEDs.
Definition componentlibrary.hpp:211
TinySimpleLight()
Definition componentlibrary.hpp:212
Definition componentlibrary.hpp:637
Trimpot()
Definition componentlibrary.hpp:640
widget::SvgWidget * bg
Definition componentlibrary.hpp:638
Definition componentlibrary.hpp:921
VCVBezelLatch()
Definition componentlibrary.hpp:922
A light for displaying on top of VCVBezel.
Definition componentlibrary.hpp:255
VCVBezelLight()
Definition componentlibrary.hpp:256
Definition componentlibrary.hpp:913
VCVBezel()
Definition componentlibrary.hpp:914
Definition componentlibrary.hpp:850
VCVButton()
Definition componentlibrary.hpp:851
Definition componentlibrary.hpp:859
VCVLatch()
Definition componentlibrary.hpp:860
Definition componentlibrary.hpp:947
VCVLightBezelLatch()
Definition componentlibrary.hpp:948
Definition componentlibrary.hpp:929
app::ModuleLightWidget * getLight()
Definition componentlibrary.hpp:939
VCVLightBezel()
Definition componentlibrary.hpp:932
app::ModuleLightWidget * light
Definition componentlibrary.hpp:930
Definition componentlibrary.hpp:890
VCVLightLatch()
Definition componentlibrary.hpp:891
Definition componentlibrary.hpp:739
VCVLightSlider()
Definition componentlibrary.hpp:740
Definition componentlibrary.hpp:730
VCVSliderLight()
Definition componentlibrary.hpp:731
Definition componentlibrary.hpp:692
VCVSlider()
Definition componentlibrary.hpp:693
DSP processor instance for your module.
Definition Module.hpp:29
Vec size
Definition math.hpp:303
Vec pos
Definition math.hpp:302
2-dimensional vector of floats, representing a point on the plane for graphics.
Definition math.hpp:189
Vec minus(Vec b) const
Definition math.hpp:212
Vec plus(Vec b) const
Definition math.hpp:209
Vec mult(float s) const
Definition math.hpp:215
float x
Definition math.hpp:190
float y
Definition math.hpp:191
Vec div(float s) const
Definition math.hpp:221
Caches its children's draw() result to a framebuffer image.
Definition FramebufferWidget.hpp:12
Owns and draws a window::Svg.
Definition SvgWidget.hpp:10
void setSvg(std::shared_ptr< window::Svg > svg)
Sets and wraps the SVG.
Definition Widget.hpp:141
NVGcontext * vg
Definition Widget.hpp:142
A node in the 2D scene graph.
Definition Widget.hpp:21
void addChildAbove(Widget *child, Widget *sibling)
void clearChildren()
Removes and deletes all child Widgets.
math::Rect box
Position relative to parent and size of widget.
Definition Widget.hpp:23
void addChild(Widget *child)
Adds widget to the top of the children.
void addChildBelow(Widget *child, Widget *sibling)
Adds widget directly below another widget.
virtual void draw(const DrawArgs &args)
Draws the widget to the NanoVG context.
static std::shared_ptr< Svg > load(const std::string &filename)
Loads Svg from a cache.