Skip to content

Improvements - #2

Closed
reversallava63 wants to merge 5 commits into
Mason363:mainfrom
reversallava63:main
Closed

reversallava63 wants to merge 5 commits into
Mason363:mainfrom
reversallava63:main

Conversation

@reversallava63

Copy link
Copy Markdown

This PR fixes the visible flicker on menu navigation and several other
screens, adds a startup splash screen, and moves the UI to a pure-black
dark theme. It also makes two small build/tooling improvements.

Why?

Interactive widgets (menu buttons, bot list rows, time-select cards,
pause overlay items, game-over buttons) were being drawn by pushing
dozens of small eadk_display_push_rect / eadk_display_pull_rect
calls per frame. Because those calls happen at arbitrary phases of the
panel scan, the beam could catch a button mid-update, producing the
characteristic flicker / tearing on arrow-key navigation.

Fix

The core change is to compose each widget into a scratch buffer and
push it to the panel in a single call, gated on eadk_display_wait_for_vblank():

  • scratch[200*56] holds the largest widget.
  • s_push() waits for vblank, then issues one push_rect.
  • Because the transfer lands during retrace and is atomic, the panel
    never sees a partial update.

On top of that:

  • list(), overlay(), time_select() and game_over() now only
    redraw the button that lost the highlight and the one that gained it,
    instead of clearing and redrawing every item on each keypress.
  • bot_select() was split into bot_row() / bot_info() /
    side_buttons(), so changing bot touches two rows plus the info
    block, and changing side touches three small rects.
  • bot_info() pre-clears only the text region instead of the whole
    160×160 right column, so the avatar repaints without a flash.
  • rrect_on() blends anti-aliased rounded corners against a known
    background colour rather than reading the screen, which lets the
    widget pre-clears be removed entirely.

Splash screen

splash() at startup fades in a 120×120 image on a black backdrop,
holds, then fades out into the menu. Fade frames are composed into a
framebuf[320*16] band and pushed one band per vblank, so the
transition is smooth and never tears.

Dark theme

  • BG is now pure black (0x0000).
  • CARD was retuned from a warm grey (0x3A,0x38,0x35) to a cool
    near-black (0x22,0x22,0x25) so buttons read as elevated surfaces
    against black rather than beige tiles.
  • Pause overlay and game-over dialog now sit on CARD to match the
    button style, with their own buttons blending corners against CARD.

Testing

  • Walked every menu, including arrow-key mashing, on an N0120.
    No flicker.
  • Played full games vs. bots and 2-player, checked board, panel,
    clocks, captures, pause overlay, resign, game-over dialog.
  • Solved and failed puzzles, tested hint / solution / next.
  • Rebuilt from clean and confirmed identical output except for the
    size line.

The splash adds ~28 KB of .rodata (120×120×2). If that's a concern
for the N0110 build, I can downsample to 96×96 or drop the splash
behind a compile-time flag.

Stopped clearing everything before redrawing to fix flicker
Flicker:
- Add scratch[200*56] buffer so interactive widgets are composed
  off-screen and pushed in one eadk_display_push_rect call instead
  of dozens of small round-trips.
- Wrap every scratch push in eadk_display_wait_for_vblank() so the
  transfer lands during retrace and can never be caught mid-scan.
- Partial redraws: list(), overlay(), time_select() and game_over()
  only redraw the button that lost the highlight and the one that
  gained it.
- bot_select() split into bot_row()/bot_info()/side_buttons() so
  changing bot touches two rows + info block, changing side touches
  three small rects.
- bot_info() pre-clear shrunk from 160x160 to just the text region
  so the avatar repaints without flashing the panel.
- rrect_on() blends AA corners against a known background colour
  instead of reading the screen, removing the BG pre-clear in
  button()/tc_card()/overlay_item()/game_over().

Splash:
- New splash() at startup: full-screen PNG blit from splash_data.h,
  then stepped fade into the menu.
- Fade composed into framebuf[320*16] and pushed one 16-row band per
  vblank so the transition is smooth and never tears.

Theme:
- BG is pure black (0x0000).
Image converted to RGB565
Improved loading animation
Decreased resolution to make it fit in 64 KB
@Mason363

Copy link
Copy Markdown
Owner

Thank you for this! NumChess has moved to NumPlay, which is where its development continues: https://github.com/Mason363/NumPlay . The flicker fix is being done there, so I'm closing this pull request here.

@Mason363 Mason363 closed this Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants