transitions
[fbgfx] / src / screen.c
index 1f1dfbe..ff88268 100644 (file)
@@ -45,6 +45,7 @@ void scr_update(void)
        if(prev) {      /* we're in the middle of a transition */
                long interval = time_msec - trans_start;
                if(interval >= trans_dur) {
+                       next->start(trans_dur);
                        prev = 0;
                        cur = next;
                        next = 0;
@@ -70,16 +71,23 @@ struct screen *scr_lookup(const char *name)
 
 int scr_change(struct screen *s, long trans_time)
 {
+       if(!s) return -1;
        if(s == cur) return 0;
 
        if(trans_time && cur) {
                trans_dur = trans_time / 2;     /* half for each part transition out then in */
                trans_start = time_msec;
 
+               if(cur) cur->stop(trans_dur);
+
                prev = cur;
                next = s;
        } else {
+               if(cur) cur->stop(0);
+               s->start(0);
+
                cur = s;
+               prev = 0;
        }
        return 0;
 }