summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2020-08-16 11:17:33 +0200
committerraysan5 <[email protected]>2020-08-16 11:17:33 +0200
commitebdeab7e2566aa131d6066aa7bad91b64fd27d07 (patch)
tree46ac4f944e708ecfbb553f4b600e6510f8a4bf59 /examples
parent7b346dbbe123b5ea89b0d46e388b4dc68c3e72a0 (diff)
downloadraylib-ebdeab7e2566aa131d6066aa7bad91b64fd27d07.tar.gz
raylib-ebdeab7e2566aa131d6066aa7bad91b64fd27d07.zip
Code reorganization on example
Diffstat (limited to 'examples')
-rw-r--r--examples/shaders/shaders_raymarching.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/examples/shaders/shaders_raymarching.c b/examples/shaders/shaders_raymarching.c
index 92272e91..5d297e36 100644
--- a/examples/shaders/shaders_raymarching.c
+++ b/examples/shaders/shaders_raymarching.c
@@ -59,16 +59,6 @@ int main(void)
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
- // Check if screen is resized
- //----------------------------------------------------------------------------------
- if(IsWindowResized())
- {
- screenWidth = GetScreenWidth();
- screenHeight = GetScreenHeight();
- float resolution[2] = { (float)screenWidth, (float)screenHeight };
- SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2);
- }
-
// Update
//----------------------------------------------------------------------------------
UpdateCamera(&camera); // Update camera
@@ -83,6 +73,15 @@ int main(void)
SetShaderValue(shader, viewEyeLoc, cameraPos, UNIFORM_VEC3);
SetShaderValue(shader, viewCenterLoc, cameraTarget, UNIFORM_VEC3);
SetShaderValue(shader, runTimeLoc, &runTime, UNIFORM_FLOAT);
+
+ // Check if screen is resized
+ if (IsWindowResized())
+ {
+ screenWidth = GetScreenWidth();
+ screenHeight = GetScreenHeight();
+ float resolution[2] = { (float)screenWidth, (float)screenHeight };
+ SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2);
+ }
//----------------------------------------------------------------------------------
// Draw