Code reorganization on example
This commit is contained in:
parent
7b346dbbe1
commit
ebdeab7e25
1 changed files with 9 additions and 10 deletions
|
@ -59,16 +59,6 @@ int main(void)
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
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
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
UpdateCamera(&camera); // Update camera
|
UpdateCamera(&camera); // Update camera
|
||||||
|
@ -83,6 +73,15 @@ int main(void)
|
||||||
SetShaderValue(shader, viewEyeLoc, cameraPos, UNIFORM_VEC3);
|
SetShaderValue(shader, viewEyeLoc, cameraPos, UNIFORM_VEC3);
|
||||||
SetShaderValue(shader, viewCenterLoc, cameraTarget, UNIFORM_VEC3);
|
SetShaderValue(shader, viewCenterLoc, cameraTarget, UNIFORM_VEC3);
|
||||||
SetShaderValue(shader, runTimeLoc, &runTime, UNIFORM_FLOAT);
|
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
|
// Draw
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue