dont remember
[vg.git] / src / vg / vg.h
index 4aec2496cdd0024caaa76f9f5546e698c969d932..5d41bcc4cf7ce92610ddf8dea63cc3f6cfab12b3 100644 (file)
@@ -486,6 +486,8 @@ static void vg_enter( int argc, char *argv[], const char *window_name )
    vg_opengl_sync_init();
    vg_loader_start();
 
+   vg.accumulator = 0.75f * (1.0f/60.0f);
+
    int loaded = 0;
    while(1)
    {
@@ -573,6 +575,25 @@ static void vg_enter( int argc, char *argv[], const char *window_name )
                   (ui_rect){ 4, 4, 250, 0 }, 0
             );
 
+            if( vg_profiler )
+            {
+               
+               char perf[128];
+               
+               snprintf( perf, 127, 
+                     "x: %d y: %d\n"
+                     "refresh: %.1f (%.1fms)\n"
+                     "samples: %d\n"
+                     "iterations: %d (acc: %.3fms%%)\n",
+                     vg.window_x, vg.window_y, 
+                     vg.refresh_rate, (1.0f/vg.refresh_rate)*1000.0f,
+                     vg.samples, 
+                     vg.fixed_iterations, 
+                     (vg.accumulator/VG_TIMESTEP_FIXED)*100.0f );
+
+               ui_text( &ui_global_ctx, (ui_rect){258, 4+24+12,0,0},perf, 1,0);
+            }
+
             audio_debug_ui( vg.pv );
             vg_ui();
             vg_console_draw();
@@ -670,6 +691,9 @@ static void vg_fatal_exit_loop( const char *error )
          if( glfwWindowShouldClose( vg.window ) )
             break;
 
+         if( glfwGetKey( vg.window, GLFW_KEY_ESCAPE ) )
+            break;
+
          glfwPollEvents();
          
          glBindFramebuffer( GL_FRAMEBUFFER, 0 );