MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/FleX / drawRoundedRect

Function drawRoundedRect

demo/d3d11/imguiGraph.cpp:153–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151*/
152
153static void drawRoundedRect(float x, float y, float w, float h, float r, float fth, unsigned int col)
154{
155 const unsigned n = CIRCLE_VERTS / 4;
156 float verts[(n + 1) * 4 * 2];
157 const float* cverts = g_circleVerts;
158 float* v = verts;
159
160 for (unsigned i = 0; i <= n; ++i)
161 {
162 *v++ = x + w - r + cverts[i * 2] * r;
163 *v++ = y + h - r + cverts[i * 2 + 1] * r;
164 }
165
166 for (unsigned i = n; i <= n * 2; ++i)
167 {
168 *v++ = x + r + cverts[i * 2] * r;
169 *v++ = y + h - r + cverts[i * 2 + 1] * r;
170 }
171
172 for (unsigned i = n * 2; i <= n * 3; ++i)
173 {
174 *v++ = x + r + cverts[i * 2] * r;
175 *v++ = y + r + cverts[i * 2 + 1] * r;
176 }
177
178 for (unsigned i = n * 3; i < n * 4; ++i)
179 {
180 *v++ = x + w - r + cverts[i * 2] * r;
181 *v++ = y + r + cverts[i * 2 + 1] * r;
182 }
183 *v++ = x + w - r + cverts[0] * r;
184 *v++ = y + r + cverts[1] * r;
185
186 drawPolygon(verts, (n + 1) * 4, fth, col);
187}
188
189
190static void drawLine(float x0, float y0, float x1, float y1, float r, float fth, unsigned int col)

Callers 1

imguiGraphDrawFunction · 0.70

Calls 1

drawPolygonFunction · 0.70

Tested by

no test coverage detected