@@ -30,7 +30,7 @@ int main(void)
3030 InitWindow (screenWidth , screenHeight , "raylib [shapes] example - pie chart" );
3131
3232 // Pie slice angles (must sum to 360)
33- const int angles [] = { 30 , 10 , 45 , 35 , 60 , 38 , 75 , 67 };
33+ const float angles [] = { 30.0f , 10.0f , 45.0f , 35.0f , 60.0f , 38.0f , 75.0f , 67.0f };
3434 const int anglesCount = (int )(sizeof (angles )/sizeof (angles [0 ]));
3535
3636 const float radius = 150.0f ;
@@ -56,14 +56,18 @@ int main(void)
5656
5757 for (int i = 0 ; i < anglesCount ; i ++ )
5858 {
59- // Gradient gray color per slice
60- unsigned char gray = (unsigned char )((i /(float )anglesCount )* 255.0f );
59+ float hue = (i /(float )anglesCount )* 360.0f ;
60+ float sat = 0.75f ;
61+ float val = 0.95f ;
62+
63+ // Convert HSV to RGBA
64+ Color col = ColorFromHSV (hue , sat , val );
6165
6266 // Draw pie piece using DrawCircleSector()
63- DrawCircleSector (center , radius , lastAngleDeg , lastAngleDeg + ( float ) angles [i ],
64- segments , ( Color ){ gray , gray , gray , 255 } );
67+ DrawCircleSector (center , radius , lastAngleDeg , lastAngleDeg + angles [i ],
68+ segments , col );
6569
66- lastAngleDeg += ( float ) angles [i ];
70+ lastAngleDeg += angles [i ];
6771 }
6872
6973 DrawText ("Pie chart drawing example" , 260 , 400 , 20 , LIGHTGRAY );
0 commit comments