Skip to content

Commit 9efe127

Browse files
committed
Update shapes_lines_drawing.c
1 parent 4caba49 commit 9efe127

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

examples/shapes/shapes_lines_drawing.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ int main(void)
5151
BeginTextureMode(canvas);
5252
ClearBackground(backgroundColor);
5353
EndTextureMode();
54+
55+
SetTargetFPS(60);
5456
//--------------------------------------------------------------------------------------
5557

5658
// Main game loop
@@ -59,10 +61,7 @@ int main(void)
5961
// Update
6062
//----------------------------------------------------------------------------------
6163
// Disable the hint text once the user clicks
62-
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && startText)
63-
{
64-
startText = false;
65-
}
64+
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && startText) startText = false;
6665

6766
// Clear the canvas when the user middle-clicks
6867
if (IsMouseButtonPressed(MOUSE_BUTTON_MIDDLE))
@@ -79,7 +78,7 @@ int main(void)
7978
if (leftButtonDown || rightButtonDown)
8079
{
8180
// The color for the line
82-
Color drawColor;
81+
Color drawColor = WHITE;
8382

8483
if (leftButtonDown)
8584
{
@@ -88,10 +87,7 @@ int main(void)
8887

8988
// While the hue is >=360, subtract it to bring it down into the range 0-360
9089
// This is more visually accurate than resetting to zero
91-
while (lineHue >= 360.0f)
92-
{
93-
lineHue -= 360.0f;
94-
}
90+
while (lineHue >= 360.0f) lineHue -= 360.0f;
9591

9692
// Create the final color
9793
drawColor = ColorFromHSV(lineHue, 1.0f, 1.0f);
@@ -104,10 +100,12 @@ int main(void)
104100

105101
// Draw the line onto the canvas
106102
BeginTextureMode(canvas);
103+
107104
// Circles act as "caps", smoothing corners
108105
DrawCircleV(mousePositionPrevious, lineThickness/2.0f, drawColor);
109106
DrawCircleV(GetMousePosition(), lineThickness/2.0f, drawColor);
110107
DrawLineEx(mousePositionPrevious, GetMousePosition(), lineThickness, drawColor);
108+
111109
EndTextureMode();
112110
}
113111

0 commit comments

Comments
 (0)