fixed more brackets

This commit is contained in:
RobinsAviary 2025-10-18 15:55:05 -04:00
parent 6ce48d01f5
commit eb33f32296

View File

@ -4,7 +4,7 @@
* *
* Example complexity rating: [] 1/4 * Example complexity rating: [] 1/4
* *
* Example originally created with raylib 5.6-dev * Example originally created with raylib 5.6-dev, last time updated with raylib 5.6
* *
* Example contributed by Robin (@RobinsAviary) and reviewed by Ramon Santamaria (@raysan5) * Example contributed by Robin (@RobinsAviary) and reviewed by Ramon Santamaria (@raysan5)
* *
@ -75,24 +75,28 @@ int main(void)
bool leftButtonDown = IsMouseButtonDown(MOUSE_BUTTON_LEFT); bool leftButtonDown = IsMouseButtonDown(MOUSE_BUTTON_LEFT);
bool rightButtonDown = IsMouseButtonDown(MOUSE_BUTTON_RIGHT); bool rightButtonDown = IsMouseButtonDown(MOUSE_BUTTON_RIGHT);
if (leftButtonDown || rightButtonDown) { if (leftButtonDown || rightButtonDown)
{
// The color for the line // The color for the line
Color drawColor; Color drawColor;
if (leftButtonDown) { if (leftButtonDown)
{
// Increase the hue value by the distance our cursor has moved since the last frame (divided by 3) // Increase the hue value by the distance our cursor has moved since the last frame (divided by 3)
lineHue += Vector2Distance(mousePositionPrevious, GetMousePosition())/3.0f; lineHue += Vector2Distance(mousePositionPrevious, GetMousePosition())/3.0f;
// While the hue is >=360, subtract it to bring it down into the range 0-360 // While the hue is >=360, subtract it to bring it down into the range 0-360
// This is more visually accurate than resetting to zero // This is more visually accurate than resetting to zero
while (lineHue >= 360.0f) { while (lineHue >= 360.0f)
{
lineHue -= 360.0f; lineHue -= 360.0f;
} }
// Create the final color // Create the final color
drawColor = ColorFromHSV(lineHue, 1.0f, 1.0f); drawColor = ColorFromHSV(lineHue, 1.0f, 1.0f);
} }
else if (rightButtonDown) { else if (rightButtonDown)
{
// Use the background color as an "eraser" // Use the background color as an "eraser"
drawColor = backgroundColor; drawColor = backgroundColor;
} }