@ -3385,6 +3385,18 @@ void AiL::DrawPie(vf2d center,float radius,float degreesCut,Pixel col){
DrawPolygonDecal ( nullptr , circleCooldownPoints , circleCooldownPoints , std : : max ( 1 , int ( degreesCut / 4 ) ) , center , radius , col ) ;
}
void AiL : : DrawPieArc ( const std : : string_view texture , vf2d center , float radius , float degreesCut , Pixel col ) {
std : : vector < vf2d > donutUVs { } ;
bool first { true } ;
std : : transform ( game - > circleCooldownPoints . begin ( ) , game - > circleCooldownPoints . end ( ) , std : : back_inserter ( donutUVs ) , [ & first ] ( const vf2d & point ) {
const bool IsFirstPoint { first } ;
first = false ;
return IsFirstPoint ? vf2d { } : vf2d { 1 , 1 } ;
}
) ;
DrawPolygonDecal ( GFX [ std : : string ( texture ) ] . Decal ( ) , circleCooldownPoints , donutUVs , std : : max ( 1 , int ( degreesCut / 4 ) ) , center , radius , col ) ;
}
void AiL : : DrawSquarePie ( vf2d center , float radius , float degreesCut , Pixel col ) {
DrawPolygonDecal ( nullptr , squareCircleCooldownPoints , squareCircleCooldownPoints , std : : max ( 1 , int ( degreesCut / 4 ) ) , center , radius , col ) ;
}
@ -3669,26 +3681,20 @@ void AiL::InitializeGraphics(){
GFX . Reset ( ) ;
Menu : : themes . Reset ( ) ;
circleCooldownPoints . push_back ( { 0 , 0 } ) ;
squareCircleCooldownPoints . push_back ( { 0 , 0 } ) ;
for ( int i = 0 ; i < = 360 ; i + = 4 ) {
float angle = util : : degToRad ( float ( i ) ) - PI / 2 ;
# pragma region Donut Circle
const float innerArcRatio { 0.8f } ;
const float innerArcRatio { 0.85f } ;
donutCircleCooldownPoints . push _back ( vf2d { cos ( angle ) , sin ( angle ) } ) ;
donutCircleCooldownPoints . push _back ( vf2d { cos ( angle ) , sin ( angle ) } * innerArcRatio ) ;
# pragma endregion
circleCooldownPoints . emplace_back ( vf2d { 0 , 0 } ) ;
squareCircleCooldownPoints . emplace_back ( vf2d { 0 , 0 } ) ;
for ( int i = 0 ; i < = 360 ; i + = 4 ) {
float angle = util : : degToRad ( float ( i ) ) - PI / 2 ;
# pragma region Cooldown Circles
if ( i = = 0 ) { circleCooldownPoints . push _back( vf2d { cos ( angle ) , sin ( angle ) } ) ; }
circleCooldownPoints . push _back( vf2d { cos ( angle ) , sin ( angle ) } ) ;
if ( i = = 0 ) { circleCooldownPoints . emplace _back( vf2d { cos ( angle ) , sin ( angle ) } ) ; }
circleCooldownPoints . emplace _back( vf2d { cos ( angle ) , sin ( angle ) } ) ;
vf2d point = vf2d { cos ( angle ) , sin ( angle ) } * sqrt ( 2.1f ) ;
point . x = std : : clamp ( point . x , - 1.f , 1.f ) ;
point . y = std : : clamp ( point . y , - 1.f , 1.f ) ;
if ( i = = 0 ) { squareCircleCooldownPoints . push _back( point ) ; }
squareCircleCooldownPoints . push _back( point ) ;
if ( i = = 0 ) { squareCircleCooldownPoints . emplace _back( point ) ; }
squareCircleCooldownPoints . emplace _back( point ) ;
# pragma endregion
}