Code reorganization on example
This commit is contained in:
parent
7b346dbbe1
commit
ebdeab7e25
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user