@@ -323,7 +323,6 @@ int main(int argc, char **argv) {
323323 int ss_dx = 1 , ss_dy = 1 ;
324324 int ss_color = 2 ;
325325 int ss_prev_x = -1 , ss_prev_y = -1 ;
326- int ss_frame = 0 ;
327326 u8 prev_kbd_keys [4 ][3 ] = {0 };
328327
329328 while (1 ) {
@@ -398,31 +397,26 @@ int main(int argc, char **argv) {
398397 ss_x = 80 ; // pixel coords now
399398 ss_y = 80 ;
400399 }
401- ss_frame ++ ;
402- if ((ss_frame & 3 ) == 0 ) {
403- // Erase prior bounding box.
404- if (ss_prev_x >= 0 ) {
405- xfb_clear_box (fb_words , FB_PITCH , ss_prev_x , ss_prev_y , LOGO_W , LOGO_H );
406- }
407- // Step + bounce. Move 4 px/update so the glide is visible without
408- // racing across the screen.
409- ss_x += ss_dx * 4 ;
410- ss_y += ss_dy * 2 ;
411- const int max_x = FB_W - LOGO_W - 24 ; // leave overscan margin
412- const int max_y = FB_H - LOGO_H - 24 ;
413- const int min_x = 24 ;
414- const int min_y = 24 ;
415- if (ss_x <= min_x ) { ss_x = min_x ; ss_dx = - ss_dx ; ss_color = (ss_color + 1 ) % CYCLE_LEN ; }
416- if (ss_x >= max_x ) { ss_x = max_x ; ss_dx = - ss_dx ; ss_color = (ss_color + 1 ) % CYCLE_LEN ; }
417- if (ss_y <= min_y ) { ss_y = min_y ; ss_dy = - ss_dy ; ss_color = (ss_color + 1 ) % CYCLE_LEN ; }
418- if (ss_y >= max_y ) { ss_y = max_y ; ss_dy = - ss_dy ; ss_color = (ss_color + 1 ) % CYCLE_LEN ; }
419- // Pixel positions must be even (XFB packs 2 px/word).
420- int draw_x = ss_x & ~1 ;
421- xfb_draw_logo (fb_words , FB_PITCH , draw_x , ss_y , & cycle_yuv [ss_color ]);
422- ss_prev_x = draw_x ;
423- ss_prev_y = ss_y ;
400+ // Update every frame with small increments → smooth glide.
401+ if (ss_prev_x >= 0 ) {
402+ xfb_clear_box (fb_words , FB_PITCH , ss_prev_x , ss_prev_y , LOGO_W , LOGO_H );
424403 }
425- LongWait (2 );
404+ ss_x += ss_dx * 3 ;
405+ ss_y += ss_dy * 2 ;
406+ const int max_x = FB_W - LOGO_W - 24 ; // leave overscan margin
407+ const int max_y = FB_H - LOGO_H - 24 ;
408+ const int min_x = 24 ;
409+ const int min_y = 24 ;
410+ if (ss_x <= min_x ) { ss_x = min_x ; ss_dx = - ss_dx ; ss_color = (ss_color + 1 ) % CYCLE_LEN ; }
411+ if (ss_x >= max_x ) { ss_x = max_x ; ss_dx = - ss_dx ; ss_color = (ss_color + 1 ) % CYCLE_LEN ; }
412+ if (ss_y <= min_y ) { ss_y = min_y ; ss_dy = - ss_dy ; ss_color = (ss_color + 1 ) % CYCLE_LEN ; }
413+ if (ss_y >= max_y ) { ss_y = max_y ; ss_dy = - ss_dy ; ss_color = (ss_color + 1 ) % CYCLE_LEN ; }
414+ // Pixel positions must be even (XFB packs 2 px/word).
415+ int draw_x = ss_x & ~1 ;
416+ xfb_draw_logo (fb_words , FB_PITCH , draw_x , ss_y , & cycle_yuv [ss_color ]);
417+ ss_prev_x = draw_x ;
418+ ss_prev_y = ss_y ;
419+ LongWait (1 ); // ~60 fps for the screensaver
426420 continue ;
427421 }
428422
0 commit comments