src/main.c
///////////////////////////////////////////////////////////////////////////////
// Update function with a fixed time step
///////////////////////////////////////////////////////////////////////////////

Update function with a fixed time step
Update function with a fixed time step
void update(void) {
    int time_to_wait = FRAME_TARGET_TIME - (SDL_GetTicks() - last_frame_time);
    if (time_to_wait > 0 && time_to_wait <= FRAME_TARGET_TIME)
        SDL_Delay(time_to_wait);
    float delta_time = (SDL_GetTicks() - last_frame_time) / 1000.0;
    last_frame_time = SDL_GetTicks();
}
void update ( void ) { int time_to_wait = FRAME_TARGET_TIME - ( SDL_GetTicks ( ) - last_frame_time ) ; if ( time_to_wait > 0 && time_to_wait <= FRAME_TARGET_TIME ) SDL_Delay ( time_to_wait ) ; float delta_time = ( SDL_GetTicks ( ) - last_frame_time ) / 1000.0 ; last_frame_time = SDL_GetTicks ( ) ; }
Update function with a fixed time step
Update function with a fixed time step
// Calculate how much we have to wait until we reach the target frame time
 // Only delay if we are too fast too update this frame
 // Get a delta time factor converted to seconds to be used to update my objects
 // Store the milliseconds of the current frame
 //printf("\n");
