mirror of
https://github.com/raysan5/raylib.git
synced 2025-11-10 12:35:08 +00:00
Remove trailing spaces
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
|
||||
10. Have fun!
|
||||
|
||||
The following files must be updated when adding a new example,
|
||||
The following files must be updated when adding a new example,
|
||||
but it can be automatically done using the raylib provided tool: rexm
|
||||
So, no worries if just the .c/.png are provided when adding the example.
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ int main(void)
|
||||
camera.projection = CAMERA_PERSPECTIVE;
|
||||
|
||||
// Load basic normal map lighting shader
|
||||
Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/normalmap.vs", GLSL_VERSION),
|
||||
Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/normalmap.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/normalmap.fs", GLSL_VERSION));
|
||||
|
||||
// Get some required shader locations
|
||||
|
||||
@@ -197,7 +197,7 @@ int main(void)
|
||||
bullets[i].color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw bullets using DrawCircle(), less performant
|
||||
|
||||
@@ -32,18 +32,18 @@ int main(void)
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - starfield effect");
|
||||
|
||||
|
||||
Color bgColor = ColorLerp(DARKBLUE, BLACK, 0.69f);
|
||||
|
||||
|
||||
// Speed at which we fly forward
|
||||
float speed = 10.0f/9.0f;
|
||||
|
||||
|
||||
// We're either drawing lines or circles
|
||||
bool drawLines = true;
|
||||
|
||||
|
||||
Vector3 stars[STAR_COUNT] = { 0 };
|
||||
Vector2 starsScreenPos[STAR_COUNT] = { 0 };
|
||||
|
||||
|
||||
// Setup the stars with a random position
|
||||
for (int i = 0; i < STAR_COUNT; i++)
|
||||
{
|
||||
@@ -65,22 +65,22 @@ int main(void)
|
||||
if ((int)mouseMove != 0) speed += 2.0f*mouseMove/9.0f;
|
||||
if (speed < 0.0f) speed = 0.1f;
|
||||
else if (speed > 2.0f) speed = 2.0f;
|
||||
|
||||
|
||||
// Toggle lines / points with space bar
|
||||
if (IsKeyPressed(KEY_SPACE)) drawLines = !drawLines;
|
||||
|
||||
|
||||
float dt = GetFrameTime();
|
||||
for (int i = 0; i < STAR_COUNT; i++)
|
||||
for (int i = 0; i < STAR_COUNT; i++)
|
||||
{
|
||||
// Update star's timer
|
||||
stars[i].z -= dt*speed;
|
||||
|
||||
|
||||
// Calculate the screen position
|
||||
starsScreenPos[i] = (Vector2){
|
||||
screenWidth*0.5f + stars[i].x/stars[i].z,
|
||||
screenHeight*0.5f + stars[i].y/stars[i].z,
|
||||
};
|
||||
|
||||
|
||||
// If the star is too old, or offscreen, it dies and we make a new random one
|
||||
if ((stars[i].z < 0.0f) || (starsScreenPos[i].x < 0) || (starsScreenPos[i].y < 0.0f) ||
|
||||
(starsScreenPos[i].x > screenWidth) || (starsScreenPos[i].y > screenHeight))
|
||||
@@ -97,14 +97,14 @@ int main(void)
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(bgColor);
|
||||
|
||||
|
||||
for (int i = 0; i < STAR_COUNT; i++)
|
||||
{
|
||||
if (drawLines)
|
||||
{
|
||||
// Get the time a little while ago for this star, but clamp it
|
||||
float t = Clamp(stars[i].z + 1.0f/32.0f, 0.0f, 1.0f);
|
||||
|
||||
|
||||
// If it's different enough from the current time, we proceed
|
||||
if ((t - stars[i].z) > 1e-3)
|
||||
{
|
||||
@@ -113,26 +113,26 @@ int main(void)
|
||||
screenWidth*0.5f + stars[i].x/t,
|
||||
screenHeight*0.5f + stars[i].y/t,
|
||||
};
|
||||
|
||||
|
||||
// Draw a line connecting the old point to the current point
|
||||
DrawLineV(startPos, starsScreenPos[i], RAYWHITE);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// Make the radius grow as the star ages
|
||||
float radius = Lerp(stars[i].z, 1.0f, 5.0f);
|
||||
|
||||
|
||||
// Draw the circle
|
||||
DrawCircleV(starsScreenPos[i], radius, RAYWHITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DrawText(TextFormat("[MOUSE WHEEL] Current Speed: %.0f", 9.0f*speed/2.0f), 10, 40, 20, RAYWHITE);
|
||||
DrawText(TextFormat("[SPACE] Current draw mode: %s", drawLines ? "Lines" : "Circles"), 10, 70, 20, RAYWHITE);
|
||||
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -1243,7 +1243,7 @@ void EnableCursor(void)
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
|
||||
#if defined(USING_VERSION_SDL3)
|
||||
// NOTE: SDL_ShowCursor() has been split into three functions:
|
||||
// NOTE: SDL_ShowCursor() has been split into three functions:
|
||||
// SDL_ShowCursor(), SDL_HideCursor(), and SDL_CursorVisible()
|
||||
SDL_ShowCursor();
|
||||
#else
|
||||
|
||||
@@ -1139,7 +1139,7 @@ void ShowCursor(void)
|
||||
// Hides mouse cursor
|
||||
void HideCursor(void)
|
||||
{
|
||||
// NOTE: We use SetCursor() instead of ShowCursor() because
|
||||
// NOTE: We use SetCursor() instead of ShowCursor() because
|
||||
// it makes it easy to only hide the cursor while it's inside the client area
|
||||
SetCursor(NULL);
|
||||
CORE.Input.Mouse.cursorHidden = true;
|
||||
|
||||
@@ -709,7 +709,7 @@ void InitWindow(int width, int height, const char *title)
|
||||
//--------------------------------------------------------------
|
||||
|
||||
// Initialize rlgl default data (buffers and shaders)
|
||||
// NOTE: CORE.Window.currentFbo.width and CORE.Window.currentFbo.height not used, just stored as globals in rlgl
|
||||
// NOTE: Current fbo size stored as globals in rlgl for convenience
|
||||
rlglInit(CORE.Window.currentFbo.width, CORE.Window.currentFbo.height);
|
||||
isGpuReady = true; // Flag to note GPU has been initialized successfully
|
||||
|
||||
|
||||
Reference in New Issue
Block a user