Group key config symbols together
[neverball] / share / state.c
index 1a43eb0..db4a845 100644 (file)
@@ -19,7 +19,8 @@
 
 /*---------------------------------------------------------------------------*/
 
-static float  state_time;
+static float         state_time;
+static int           state_drawn;
 static struct state *state;
 
 struct state *curr_state(void)
@@ -42,8 +43,9 @@ int goto_state(struct state *st)
     if (state && state->leave)
         state->leave(state->gui_id);
 
-    state      = st;
-    state_time =  0;
+    state       = st;
+    state_time  = 0;
+    state_drawn = 0;
 
     if (state && state->enter)
         state->gui_id = state->enter();
@@ -57,21 +59,23 @@ void st_paint(float t)
 {
     int stereo = config_get_d(CONFIG_STEREO);
 
+    state_drawn = 1;
+
     if (state && state->paint)
     {
         if (stereo)
         {
             glDrawBuffer(GL_BACK_LEFT);
-            config_clear();
+            video_clear();
             state->paint(state->gui_id, t);
 
             glDrawBuffer(GL_BACK_RIGHT);
-            config_clear();
+            video_clear();
             state->paint(state->gui_id, t);
         }
         else
         {
-            config_clear();
+            video_clear();
             state->paint(state->gui_id, t);
         }
     }
@@ -79,6 +83,9 @@ void st_paint(float t)
 
 void st_timer(float dt)
 {
+    if (!state_drawn)
+        return;
+
     state_time += dt;
 
     if (state && state->timer)