@@ -807,6 +807,94 @@ void CGraphics::DrawRectQueued(float fX, float fY, float fWidth, float fHeight,
807807 AddQueueItem (Item, bPostGUI);
808808}
809809
810+ void CGraphics::DrawCircleQueued (float fX , float fY , float fRadius , float fStartAngle , float fStopAngle , unsigned long ulColor, unsigned long ulColorCenter, ushort fSegments , float fRatio , bool bPostGUI)
811+ {
812+ if (g_pCore->IsWindowMinimized ())
813+ return ;
814+
815+ BeginDrawBatch ();
816+ CheckModes (EDrawMode::DX_SPRITE, m_ActiveBlendMode);
817+
818+ // Set up a queue item
819+ sDrawQueueItem Item;
820+ Item.eType = QUEUE_CIRCLE;
821+ Item.blendMode = m_ActiveBlendMode;
822+ Item.Circle .fX = fX ;
823+ Item.Circle .fY = fY ;
824+ Item.Circle .fRadius = fRadius ;
825+ Item.Circle .fStartAngle = fStartAngle ;
826+ Item.Circle .fStopAngle = fStopAngle ;
827+ Item.Circle .bPostGUI = bPostGUI;
828+ Item.Circle .fSegments = fSegments ;
829+ Item.Circle .fRatio = fRatio ;
830+ Item.Circle .ulColor = ulColor;
831+ Item.Circle .ulColorCenter = ulColorCenter;
832+ // Add it to the queue
833+ AddQueueItem (Item, bPostGUI);
834+
835+ DrawCircleInternal (fX , fY , fRadius , fStartAngle , fStopAngle , ulColor, ulColorCenter, fSegments , fRatio , bPostGUI);
836+
837+ EndDrawBatch ();
838+ }
839+
840+ struct stVertex
841+ {
842+ float x, y, z;
843+ D3DCOLOR color;
844+ };
845+
846+ void CGraphics::DrawCircleInternal (float fX , float fY , float fRadius , float fStartAngle , float fStopAngle , unsigned long ulColor, unsigned long ulColorCenter, ushort fSegments , float fRatio , bool bPostGUI)
847+ {
848+ fStartAngle = D3DXToRadian (fStartAngle );
849+ fStopAngle = D3DXToRadian (fStopAngle );
850+
851+ std::vector<stVertex> vecPoints;
852+
853+ // center
854+ stVertex vertCenter;
855+ vertCenter.x = fX ;
856+ vertCenter.y = fY ;
857+ vertCenter.z = 0 ;
858+ vertCenter.color = ulColorCenter;
859+ vecPoints.push_back (vertCenter);
860+
861+ // first
862+ stVertex vertFirst;
863+ vertFirst.x = fX + fRadius * cos (fStartAngle ) * fRatio ;
864+ vertFirst.y = fY + fRadius * sin (fStartAngle ) / fRatio ;
865+ vertFirst.z = 0 ;
866+ vertFirst.color = ulColor;
867+ vecPoints.push_back (vertFirst);
868+
869+ float fSegments2 = (float )fSegments + 1 ;
870+ float segmentAngle = ((fStopAngle - fStartAngle ) / fSegments2 );
871+
872+ for (float fAngle = fStartAngle ; fAngle <= fStopAngle ;)
873+ {
874+ stVertex vertex;
875+ vertex.x = fX + fRadius * cos (fAngle ) * fRatio ;
876+ vertex.y = fY + fRadius * sin (fAngle ) / fRatio ;
877+ vertex.z = 0 ;
878+ vertex.color = ulColor;
879+ vecPoints.push_back (vertex);
880+ fAngle = fAngle + segmentAngle;
881+ }
882+
883+ // last
884+ stVertex vertLast;
885+ vertLast.x = fX + fRadius * cos (fStopAngle ) * fRatio ;
886+ vertLast.y = fY + fRadius * sin (fStopAngle ) / fRatio ;
887+ vertLast.z = 0 ;
888+ vertLast.color = ulColor;
889+ vecPoints.push_back (vertLast);
890+
891+ if (vecPoints.size () >= 3 )
892+ {
893+ m_pDevice->SetTexture (0 , 0 );
894+ m_pDevice->DrawPrimitiveUP (D3DPT_TRIANGLEFAN, vecPoints.size () - 2 , &vecPoints[0 ], sizeof (stVertex));
895+ }
896+ }
897+
810898void CGraphics::DrawTextureQueued (float fX , float fY , float fWidth , float fHeight , float fU , float fV , float fSizeU , float fSizeV , bool bRelativeUV,
811899 CMaterialItem* pMaterial, float fRotation , float fRotCenOffX , float fRotCenOffY , unsigned long ulColor, bool bPostGUI)
812900{
@@ -1445,6 +1533,13 @@ void CGraphics::DrawQueueItem(const sDrawQueueItem& Item)
14451533 DrawRectangleInternal (Item.Rect .fX , Item.Rect .fY , Item.Rect .fWidth , Item.Rect .fHeight , Item.Rect .ulColor , Item.Rect .bSubPixelPositioning );
14461534 break ;
14471535 }
1536+ case QUEUE_CIRCLE:
1537+ {
1538+ CheckModes (EDrawMode::DX_SPRITE, Item.blendMode );
1539+ DrawCircleInternal (Item.Circle .fX , Item.Circle .fY , Item.Circle .fRadius , Item.Circle .fStartAngle , Item.Circle .fStopAngle , Item.Circle .ulColor , Item.Circle .ulColorCenter , Item.Circle .fSegments , Item.Circle .fRatio , Item.Circle .bPostGUI );
1540+ break ;
1541+ }
1542+
14481543 case QUEUE_TEXT:
14491544 {
14501545 RECT rect;
0 commit comments