MCPcopy Create free account
hub / github.com/DISTRHO/DPF / onDisplay

Method onDisplay

tests/Demo.cpp:104–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102
103protected:
104 void onDisplay() override
105 {
106 const GraphicsContext& context(getGraphicsContext());
107 const double scaleFactor = getWindow().getScaleFactor();
108 const int iconSize = bgIcon.getWidth();
109
110 Color(0.027f, 0.027f, 0.027f).setFor(context);
111 Rectangle<uint>(0, 0, getSize()).draw(context);
112
113 bgIcon.setY(curPage * iconSize + curPage * 3 * scaleFactor);
114
115 Color(0.129f, 0.129f, 0.129f).setFor(context);
116 bgIcon.draw(context);
117
118 Color(0.184f, 0.184f, 0.184f).setFor(context);
119 bgIcon.drawOutline(context);
120
121 if (curHover != curPage && curHover != -1)
122 {
123 Rectangle<int> rHover(1 * scaleFactor, curHover * iconSize + curHover * 3 * scaleFactor,
124 iconSize - 2 * scaleFactor, iconSize - 2 * scaleFactor);
125
126 Color(0.071f, 0.071f, 0.071f).setFor(context);
127 rHover.draw(context);
128
129 Color(0.102f, 0.102f, 0.102f).setFor(context);
130 rHover.drawOutline(context);
131 }
132
133 Color(0.184f, 0.184f, 0.184f).setFor(context);
134 lineSep.draw(context);
135
136 // reset color
137 Color(1.0f, 1.0f, 1.0f, 1.0f).setFor(context, true);
138
139 const int pad = iconSize/2 - DemoArtwork::ico1Width/2;
140
141 img1.drawAt(context, pad, pad);
142 img2.drawAt(context, pad, pad + 3 + iconSize);
143 img3.drawAt(context, pad, pad + 6 + iconSize*2);
144 img4.drawAt(context, pad, pad + 9 + iconSize*3);
145
146 #ifdef DGL_OPENGL
147 img5.drawAt(context, pad, pad + 12 + iconSize*4);
148
149 // draw some text
150 nvg.beginFrame(this);
151
152 nvg.fontSize(23.0f * scaleFactor);
153 nvg.textAlign(NanoVG::ALIGN_LEFT|NanoVG::ALIGN_TOP);
154 //nvg.textLineHeight(20.0f);
155
156 nvg.fillColor(220,220,220,220);
157 nvg.textBox(10 * scaleFactor, 420 * scaleFactor, iconSize, "Haha,", nullptr);
158 nvg.textBox(15 * scaleFactor, 440 * scaleFactor, iconSize, "Look!", nullptr);
159
160 nvg.endFrame();
161 #endif

Callers

nothing calls this directly

Calls 14

setYMethod · 0.80
beginFrameMethod · 0.80
fontSizeMethod · 0.80
textAlignMethod · 0.80
fillColorMethod · 0.80
textBoxMethod · 0.80
endFrameMethod · 0.80
getSizeFunction · 0.50
getScaleFactorMethod · 0.45
getWidthMethod · 0.45
setForMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected