Skip to content

Commit 2d835f7

Browse files
Screensaver: smoother + faster + larger.
- Logo bumped 128x128 → 160x160. - Step every frame instead of every 4th, 3px/frame horizontal + 2px/frame vertical. Net feel: smoother glide, slightly faster than before. - Drop the unused ss_frame counter.
1 parent b688eec commit 2d835f7

2 files changed

Lines changed: 21 additions & 27 deletions

File tree

gamecube/buildtools/make_logo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
from PIL import Image
1717

18-
LOGO_W = 128
19-
LOGO_H = 128
18+
LOGO_W = 160
19+
LOGO_H = 160
2020

2121
HERE = Path(__file__).parent
2222
PROJECT = HERE.parent

gamecube/ppc/main.c

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)