@@ -31,19 +31,21 @@ int main(void)
3131 InitWindow (screenWidth , screenHeight , "raylib [shapes] example - kaleidoscope" );
3232
3333 int symmetry = 6 ;
34- float angle = 360.0f / (float )symmetry ;
34+ float angle = 360.0f / (float )symmetry ;
3535 float thickness = 3.0f ;
3636 Vector2 prevMousePos = { 0 };
3737
3838 SetTargetFPS (60 );
3939 ClearBackground (BLACK );
4040
41- Vector2 offset = {(float )screenWidth / 2.0f , (float )screenHeight / 2.0f };
41+ Vector2 offset = { (float )screenWidth / 2.0f , (float )screenHeight / 2.0f };
4242 Camera2D camera = { 0 };
4343 camera .target = (Vector2 ){ 0 };
4444 camera .offset = offset ;
4545 camera .rotation = 0.0f ;
4646 camera .zoom = 1.0f ;
47+
48+ Vector2 scaleVector = { 1.0f , -1.0f };
4749 //--------------------------------------------------------------------------------------
4850
4951 // Main game loop
@@ -52,23 +54,21 @@ int main(void)
5254 // Update
5355 //----------------------------------------------------------------------------------
5456 Vector2 mousePos = GetMousePosition ();
57+ Vector2 lineStart = Vector2Subtract (mousePos , offset );
58+ Vector2 lineEnd = Vector2Subtract (prevMousePos , offset );
5559 //----------------------------------------------------------------------------------
5660
5761 // Draw
5862 //----------------------------------------------------------------------------------
5963 BeginDrawing ();
6064 BeginMode2D (camera );
61- Vector2 lineStart = Vector2Subtract (mousePos , offset );
62- Vector2 lineEnd = Vector2Subtract (prevMousePos , offset );
63-
6465 if (IsMouseButtonDown (MOUSE_LEFT_BUTTON )) {
6566 for (int i = 0 ; i < symmetry ; i ++ ) {
66- lineStart = Vector2Rotate (lineStart , angle * DEG2RAD );
67- lineEnd = Vector2Rotate (lineEnd , angle * DEG2RAD );
67+ lineStart = Vector2Rotate (lineStart , angle * DEG2RAD );
68+ lineEnd = Vector2Rotate (lineEnd , angle * DEG2RAD );
6869
6970 DrawLineEx (lineStart , lineEnd , thickness , WHITE );
7071
71- Vector2 scaleVector = {1.0f , -1.0f };
7272 Vector2 reflectLineStart = Vector2Multiply (lineStart , scaleVector );
7373 Vector2 reflectLineEnd = Vector2Multiply (lineEnd , scaleVector );
7474
0 commit comments