Mosaic and fade screen transition effects. More...
#include <snes.h>Functions | |
| void | doMosaicIn (void) |
| Animate the mosaic filter shrinking back to normal, then disable it. | |
| void | doMosaicOut (void) |
| Activate the hardware mosaic filter and animate pixel blocks growing. | |
| int | main (void) |
| Entry point: set up a background and cycle through transition effects. | |
| void | WaitForKey (void) |
| Block until a button is pressed, debouncing any currently held buttons. | |
Variables | |
| u8 | palette [] |
| 16-color palette for the background tiles | |
| u8 | palette_end [] |
| u8 | tilemap [] |
| Background tilemap data mapping tiles to the 32x32 grid. | |
| u8 | tilemap_end [] |
| u8 | tiles [] |
| 4bpp background tile data (defined in data.asm, stored in ROM) | |
| u8 | tiles_end [] |
Mosaic and fade screen transition effects.
Demonstrates two SNES screen transition techniques: brightness fading and the hardware mosaic filter. Brightness fading uses register $2100 (INIDISP) to ramp the master brightness from 0 (black) to 15 (full) over multiple frames. The mosaic effect uses register $2106 (MOSAIC) to progressively enlarge the pixel blocks on selected BG layers, creating a pixelation effect commonly used in RPG battle transitions.
| void doMosaicIn | ( | void | ) |
Animate the mosaic filter shrinking back to normal, then disable it.
mosaicFadeIn() decreases the mosaic block size from 16 back to 1, restoring the original image. mosaicDisable() then clears the mosaic register so the PPU no longer applies the filter, saving a tiny bit of processing.
| void doMosaicOut | ( | void | ) |
Activate the hardware mosaic filter and animate pixel blocks growing.
The SNES mosaic register ($2106) groups NxN pixel blocks and fills each block with the color of its top-left pixel. mosaicFadeOut() increases N from 1 to 16 over time, making the image progressively more pixelated. The speed parameter (3) controls how many frames each mosaic level is held.
This effect is commonly used in RPG battle transitions (e.g., Final Fantasy).
| int main | ( | void | ) |
Entry point: set up a background and cycle through transition effects.
Initializes Mode 1 with a single 4bpp background layer, then enters an infinite loop cycling through four effects on each button press: fade out -> fade in -> mosaic out -> mosaic in.
| void WaitForKey | ( | void | ) |
Block until a button is pressed, debouncing any currently held buttons.
First waits for all buttons to be released (debounce), then waits for any new button press. Each iteration calls WaitForVBlank() to yield to the NMI handler so the system stays synchronized to the 60Hz refresh rate.
|
extern |
16-color palette for the background tiles
| u8 palette_end[] |
|
extern |
Background tilemap data mapping tiles to the 32x32 grid.
| u8 tilemap_end[] |
|
extern |
4bpp background tile data (defined in data.asm, stored in ROM)
| u8 tiles_end[] |