mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-06 06:13:10 +00:00
REVIEWED: examples: Replace TABS and Remove trailing spaces
This commit is contained in:
parent
bd21d74914
commit
0b9f463e64
@ -16,6 +16,7 @@
|
|||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
#include "raymath.h"
|
#include "raymath.h"
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
@ -39,9 +40,6 @@ int main(void)
|
|||||||
// The canvas to draw lines on
|
// The canvas to draw lines on
|
||||||
RenderTexture canvas = LoadRenderTexture(screenWidth, screenHeight);
|
RenderTexture canvas = LoadRenderTexture(screenWidth, screenHeight);
|
||||||
|
|
||||||
// The background color of the canvas
|
|
||||||
const Color backgroundColor = RAYWHITE;
|
|
||||||
|
|
||||||
// The line's thickness
|
// The line's thickness
|
||||||
float lineThickness = 8.0f;
|
float lineThickness = 8.0f;
|
||||||
// The lines hue (in HSV, from 0-360)
|
// The lines hue (in HSV, from 0-360)
|
||||||
@ -49,7 +47,7 @@ int main(void)
|
|||||||
|
|
||||||
// Clear the canvas to the background color
|
// Clear the canvas to the background color
|
||||||
BeginTextureMode(canvas);
|
BeginTextureMode(canvas);
|
||||||
ClearBackground(backgroundColor);
|
ClearBackground(RAYWHITE);
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
|
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
@ -67,7 +65,7 @@ int main(void)
|
|||||||
if (IsMouseButtonPressed(MOUSE_BUTTON_MIDDLE))
|
if (IsMouseButtonPressed(MOUSE_BUTTON_MIDDLE))
|
||||||
{
|
{
|
||||||
BeginTextureMode(canvas);
|
BeginTextureMode(canvas);
|
||||||
ClearBackground(backgroundColor);
|
ClearBackground(RAYWHITE);
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,20 +90,14 @@ int main(void)
|
|||||||
// 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) drawColor = RAYWHITE; // Use the background color as an "eraser"
|
||||||
{
|
|
||||||
// Use the background color as an "eraser"
|
|
||||||
drawColor = backgroundColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw the line onto the canvas
|
// Draw the line onto the canvas
|
||||||
BeginTextureMode(canvas);
|
BeginTextureMode(canvas);
|
||||||
|
|
||||||
// Circles act as "caps", smoothing corners
|
// Circles act as "caps", smoothing corners
|
||||||
DrawCircleV(mousePositionPrevious, lineThickness/2.0f, drawColor);
|
DrawCircleV(mousePositionPrevious, lineThickness/2.0f, drawColor);
|
||||||
DrawCircleV(GetMousePosition(), lineThickness/2.0f, drawColor);
|
DrawCircleV(GetMousePosition(), lineThickness/2.0f, drawColor);
|
||||||
DrawLineEx(mousePositionPrevious, GetMousePosition(), lineThickness, drawColor);
|
DrawLineEx(mousePositionPrevious, GetMousePosition(), lineThickness, drawColor);
|
||||||
|
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,6 +112,7 @@ int main(void)
|
|||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
// Draw the render texture to the screen, flipped vertically to make it appear top-side up
|
// 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);
|
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
|
// Draw the hint text
|
||||||
if (startText) DrawText("try clicking and dragging!", 275, 215, 20, LIGHTGRAY);
|
if (startText) DrawText("try clicking and dragging!", 275, 215, 20, LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
// Unload the canvas render texture
|
UnloadRenderTexture(canvas); // Unload the canvas render texture
|
||||||
UnloadRenderTexture(canvas);
|
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user