1
1
#ifndef DHE_GUI_WIDGET_H
2
2
#define DHE_GUI_WIDGET_H
3
3
4
- #include " app.hpp"
5
- #include " engine.hpp"
6
- #include " math.hpp"
7
- #include " rack.hpp"
4
+ #include < app.hpp>
5
+ #include < math.hpp>
6
+ #include < rack.hpp>
8
7
9
8
namespace DHE {
10
9
class Widget : public rack ::ModuleWidget {
@@ -14,7 +13,7 @@ class Widget : public rack::ModuleWidget {
14
13
Widget (rack::Module *module, int widget_hp, const char *background);
15
14
16
15
rack::Vec center () {
17
- return box.getCenter ();
16
+ return box.getCenter ();
18
17
}
19
18
20
19
float height () const {
@@ -27,7 +26,7 @@ class Widget : public rack::ModuleWidget {
27
26
28
27
template <class T >
29
28
void install_input (int index, float x, float y) {
30
- auto input{rack::createInput<T>(rack::Vec ( x, y) , module, index )};
29
+ auto input{rack::createInput<T>({ x, y} , module, index )};
31
30
moveTo (input->box , x, y);
32
31
addInput (input);
33
32
}
@@ -47,7 +46,7 @@ class Widget : public rack::ModuleWidget {
47
46
}
48
47
49
48
template <class T >
50
- void install_light (int index, float x, float y, float initial = 0 .5f ) {
49
+ void install_light (int index, float x, float y, float initial = 0 .f ) {
51
50
auto light{rack::createLight<T>({x, y}, module, index )};
52
51
moveTo (light->box , x, y);
53
52
addChild (light);
@@ -64,14 +63,9 @@ class Widget : public rack::ModuleWidget {
64
63
moveTo (widget->box , pos);
65
64
addChild (widget);
66
65
}
66
+ static void moveTo (rack::Rect &box, rack::Vec pos);
67
67
68
- static void moveTo (rack::Rect &box, rack::Vec pos) {
69
- box.pos = pos.minus (box.size .mult (0 .5f ));
70
- }
71
-
72
- static void moveTo (rack::Rect &box, float x, float y) {
73
- moveTo (box, {x, y});
74
- }
68
+ static void moveTo (rack::Rect &box, float x, float y);
75
69
76
70
void install_screws ();
77
71
};
0 commit comments