@@ -33,7 +33,7 @@ int main(void)
3333
3434 InitWindow (screenWidth , screenHeight , "raylib [shapes] example - triangle strip" );
3535
36- Vector2 points [120 ] = { 0 };
36+ Vector2 points [122 ] = { 0 };
3737 Vector2 center = { (screenWidth /2.0f ) - 125.f , screenHeight /2.0f };
3838 float segments = 6.0f ;
3939 float insideRadius = 100.0f ;
@@ -69,17 +69,22 @@ int main(void)
6969
7070 ClearBackground (RAYWHITE );
7171
72- for (int i = 0 , i2 = 0 ; i < pointCount ; i ++ , i2 += 2 )
72+ for (int i = 0 ; i < pointCount ; i ++ )
7373 {
74+ Vector2 a = points [i * 2 ];
75+ Vector2 b = points [i * 2 + 1 ];
76+ Vector2 c = points [i * 2 + 2 ];
77+ Vector2 d = points [i * 2 + 3 ];
78+
7479 float angle1 = i * angleStep ;
75- Color color = ColorFromHSV (angle1 * RAD2DEG , 1.0f , 1.0f );
76- DrawTriangle (points [ i2 + 2 ], points [ i2 + 1 ], points [ i2 ], color );
77- if ( outline ) DrawTriangleLines ( points [ i2 ], points [ i2 + 1 ], points [ i2 + 2 ], BLACK );
78-
79- float angle2 = angle1 + angleStep / 2.0f ;
80- color = ColorFromHSV ( angle2 * RAD2DEG , 1.0f , 1.0f );
81- DrawTriangle ( points [ i2 + 3 ], points [ i2 + 1 ], points [ i2 + 2 ], color );
82- if ( outline ) DrawTriangleLines ( points [ i2 + 2 ], points [ i2 + 1 ], points [ i2 + 3 ], BLACK );
80+ DrawTriangle ( c , b , a , ColorFromHSV (angle1 * RAD2DEG , 1.0f , 1.0f ) );
81+ DrawTriangle (d , b , c , ColorFromHSV (( angle1 + angleStep / 2 ) * RAD2DEG , 1.0f , 1.0f ) );
82+
83+ if ( outline )
84+ {
85+ DrawTriangleLines ( a , b , c , BLACK );
86+ DrawTriangleLines ( c , b , d , BLACK );
87+ }
8388 }
8489
8590 DrawLine (580 , 0 , 580 , GetScreenHeight (), (Color ){ 218 , 218 , 218 , 255 });
0 commit comments