Screen transitions: brightness fades and the mosaic filter. More...
Functions | |
| int | main (void) |
| Entry point – cycles through the fades at three speeds, then the mosaic. | |
| static void | wait_for_key (void) |
Variables | |
| u16 | fade_ticks |
| 4bpp tile data for the background image. | |
Screen transitions: brightness fades and the mosaic filter.
The two transitions the PPU gives for free. A fade steps the master brightness of INIDISP ($2100) from 15 (full) to 0 (black) and back; the mosaic filter (MOSAIC, $2106) fills N x N blocks of a background with the colour of their top-left pixel, from 1 x 1 up to 16 x 16. Three fade speeds are shown, then the mosaic growing and shrinking back. Neither costs CPU time beyond one register write per step.
| int main | ( | void | ) |
Entry point – cycles through the fades at three speeds, then the mosaic.
Loads a background image, then enters an interactive loop where each button press triggers the next transition: fade out and in at 1, 3 and 6 frames per step, then the mosaic growing to 16 x 16 blocks and shrinking back. The cycle repeats indefinitely.
|
static |
| u16 fade_ticks |
4bpp tile data for the background image.
Tilemap data (32x32 tile grid) for the background image.
15-bit BGR palette (up to 16 colors) for the background image.
Block until the user presses a button (with debounce).
First waits for all buttons to be released (if any are held), then waits for a new button press. This two-phase approach prevents the same press from being detected twice and ensures clean transition between fade steps. Each iteration calls WaitForVBlank() to yield CPU time and synchronize with the display refresh.
Frames the main loop ran during the non-blocking fades (96 a fade at 6 frames per step).