-
- /* tick the state manager forward by the change in time */
- //state_tick(delta_ticks);
- main_loop_last_ticks = SDL_GetTicks();
-
- /* render the scene to backbuffer */
-////TODO: state_tick(delta_ticks);
- /* swap in the backbuffer for display */
-////TODO: state_render();
-
-#ifdef LOOP_YIELD_OPTIONAL
-#define DIV_UP(x,y) ((x + (y / 2)) / y)
-
- /* cap the framerate if we're handling the loop mechanism directly, but only
- yield if we have a substantial portion of time to yield (1/10th of the
- target delta) */
- delta_ticks = SDL_GetTicks() - main_loop_last_ticks;
- if ((delta_ticks + DIV_UP(TARGET_DT, 10)) < TARGET_DT)
+ /* tick the state manager and immediately save the time */
+ state_tick(delta_ticks);
+ state_last_ticks = SDL_GetTicks();
+
+ //TODO: render(screen)
+ //TODO: SDL_Flip(screen)::sdl_geterror
+
+#ifndef NON_BLOCKING_LOOPS
+#define DIV_UP(x,y) (((x) + ((y) / 2)) / (x))
+ /* yield if we have a substantial portion of time leftover */
+ delta_ticks += SDL_GetTicks() - state_last_ticks;
+ if (delta_ticks < (TARGET_DT - DIV_UP(TARGET_DT, 10)))