REVIEWED: examples: Replace TABS and Remove trailing spaces

This commit is contained in:
Ray 2025-11-19 13:18:10 +01:00
parent bd21d74914
commit 0b9f463e64
36 changed files with 440 additions and 447 deletions

View File

@ -16,6 +16,7 @@
********************************************************************************************/
#include "raylib.h"
#include "raymath.h"
//------------------------------------------------------------------------------------
@ -39,9 +40,6 @@ int main(void)
// The canvas to draw lines on
RenderTexture canvas = LoadRenderTexture(screenWidth, screenHeight);
// The background color of the canvas
const Color backgroundColor = RAYWHITE;
// The line's thickness
float lineThickness = 8.0f;
// The lines hue (in HSV, from 0-360)
@ -49,7 +47,7 @@ int main(void)
// Clear the canvas to the background color
BeginTextureMode(canvas);
ClearBackground(backgroundColor);
ClearBackground(RAYWHITE);
EndTextureMode();
SetTargetFPS(60);
@ -67,7 +65,7 @@ int main(void)
if (IsMouseButtonPressed(MOUSE_BUTTON_MIDDLE))
{
BeginTextureMode(canvas);
ClearBackground(backgroundColor);
ClearBackground(RAYWHITE);
EndTextureMode();
}
@ -92,20 +90,14 @@ int main(void)
// Create the final color
drawColor = ColorFromHSV(lineHue, 1.0f, 1.0f);
}
else if (rightButtonDown)
{
// Use the background color as an "eraser"
drawColor = backgroundColor;
}
else if (rightButtonDown) drawColor = RAYWHITE; // Use the background color as an "eraser"
// Draw the line onto the canvas
BeginTextureMode(canvas);
// Circles act as "caps", smoothing corners
DrawCircleV(mousePositionPrevious, lineThickness/2.0f, drawColor);
DrawCircleV(GetMousePosition(), lineThickness/2.0f, drawColor);
DrawLineEx(mousePositionPrevious, GetMousePosition(), lineThickness, drawColor);
EndTextureMode();
}
@ -120,6 +112,7 @@ int main(void)
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
// Draw the render texture to the screen, flipped vertically to make it appear top-side up
DrawTextureRec(canvas.texture, (Rectangle){ 0.0f, 0.0f, (float)canvas.texture.width,(float)-canvas.texture.height }, Vector2Zero(), WHITE);
@ -128,14 +121,14 @@ int main(void)
// Draw the hint text
if (startText) DrawText("try clicking and dragging!", 275, 215, 20, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
// Unload the canvas render texture
UnloadRenderTexture(canvas);
UnloadRenderTexture(canvas); // Unload the canvas render texture
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------