mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-07 11:58:13 +00:00
Remove trail spaces
This commit is contained in:
@@ -65,36 +65,36 @@ int main(void)
|
||||
// Set shader required uniform values
|
||||
SetShaderValue(shader, timeLoc, &totalTime, SHADER_UNIFORM_FLOAT);
|
||||
SetShaderValue(shader, mouseLoc, mousePos, SHADER_UNIFORM_VEC2);
|
||||
|
||||
|
||||
// Hot shader reloading
|
||||
if (shaderAutoReloading || (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)))
|
||||
{
|
||||
long currentFragShaderModTime = GetFileModTime(TextFormat(fragShaderFileName, GLSL_VERSION));
|
||||
|
||||
|
||||
// Check if shader file has been modified
|
||||
if (currentFragShaderModTime != fragShaderFileModTime)
|
||||
{
|
||||
// Try reloading updated shader
|
||||
Shader updatedShader = LoadShader(0, TextFormat(fragShaderFileName, GLSL_VERSION));
|
||||
|
||||
|
||||
if (updatedShader.id != rlGetShaderDefault().id) // It was correctly loaded
|
||||
{
|
||||
UnloadShader(shader);
|
||||
shader = updatedShader;
|
||||
|
||||
|
||||
// Get shader locations for required uniforms
|
||||
resolutionLoc = GetShaderLocation(shader, "resolution");
|
||||
mouseLoc = GetShaderLocation(shader, "mouse");
|
||||
timeLoc = GetShaderLocation(shader, "time");
|
||||
|
||||
|
||||
// Reset required uniforms
|
||||
SetShaderValue(shader, resolutionLoc, resolution, SHADER_UNIFORM_VEC2);
|
||||
}
|
||||
|
||||
|
||||
fragShaderFileModTime = currentFragShaderModTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (IsKeyPressed(KEY_A)) shaderAutoReloading = !shaderAutoReloading;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
@@ -109,10 +109,10 @@ int main(void)
|
||||
DrawRectangle(0, 0, screenWidth, screenHeight, WHITE);
|
||||
EndShaderMode();
|
||||
|
||||
DrawText(TextFormat("PRESS [A] to TOGGLE SHADER AUTOLOADING: %s",
|
||||
DrawText(TextFormat("PRESS [A] to TOGGLE SHADER AUTOLOADING: %s",
|
||||
shaderAutoReloading? "AUTO" : "MANUAL"), 10, 10, 10, shaderAutoReloading? RED : BLACK);
|
||||
if (!shaderAutoReloading) DrawText("MOUSE CLICK to SHADER RE-LOADING", 10, 30, 10, BLACK);
|
||||
|
||||
|
||||
DrawText(TextFormat("Shader last modification: %s", asctime(localtime(&fragShaderFileModTime))), 10, 430, 10, BLACK);
|
||||
|
||||
EndDrawing();
|
||||
|
Reference in New Issue
Block a user