Godzil hace 3 años
padre
commit
023f202279
Se han modificado 1 ficheros con 6 adiciones y 3 borrados
  1. 6 3
      source/main.c

+ 6 - 3
source/main.c

@@ -121,11 +121,14 @@ void update()
 {
     int i;
 
-    while(!SDL_TICKS_PASSED(SDL_GetTicks(), previousFrameTime + FRAME_TARGET_TIME));
-
+    uint32_t timeToWait = FRAME_TARGET_TIME - (SDL_GetTicks() - previousFrameTime);
+    if (timeToWait <= FRAME_TARGET_TIME)
+    {
+        SDL_Delay(timeToWait);
+    }
     previousFrameTime = SDL_GetTicks();
 
-    cubeRotation.x += 0.01;
+    cubeRotation.@x += 0.01;
     cubeRotation.y += 0.01;
     cubeRotation.z += 0.01;