MCPcopy Create free account
hub / github.com/ddnet/ddnet / DrawCircle

Method DrawCircle

src/engine/client/graphics_threaded.cpp:1331–1354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1329}
1330
1331void CGraphics_Threaded::DrawCircle(float CenterX, float CenterY, float Radius, int Segments)
1332{
1333 IGraphics::CFreeformItem aItems[32];
1334 size_t NumItems = 0;
1335 const float SegmentsAngle = 2 * pi / Segments;
1336 for(int i = 0; i < Segments; i += 2)
1337 {
1338 const float a1 = i * SegmentsAngle;
1339 const float a2 = (i + 1) * SegmentsAngle;
1340 const float a3 = (i + 2) * SegmentsAngle;
1341 aItems[NumItems++] = IGraphics::CFreeformItem(
1342 CenterX, CenterY,
1343 CenterX + std::cos(a1) * Radius, CenterY + std::sin(a1) * Radius,
1344 CenterX + std::cos(a3) * Radius, CenterY + std::sin(a3) * Radius,
1345 CenterX + std::cos(a2) * Radius, CenterY + std::sin(a2) * Radius);
1346 if(NumItems == std::size(aItems))
1347 {
1348 QuadsDrawFreeform(aItems, std::size(aItems));
1349 NumItems = 0;
1350 }
1351 }
1352 if(NumItems)
1353 QuadsDrawFreeform(aItems, NumItems);
1354}
1355
1356void CGraphics_Threaded::RenderTileLayer(int BufferContainerIndex, const ColorRGBA &Color, char **pOffsets, unsigned int *pIndicedVertexDrawNum, size_t NumIndicesOffset)
1357{

Callers 5

PopupColorPickerMethod · 0.80
OnRenderMethod · 0.80
RenderMethod · 0.80
RenderScreenSizesMethod · 0.80
RenderMethod · 0.80

Calls 1

CFreeformItemClass · 0.85

Tested by

no test coverage detected