Color addition transparency between two background layers. More...
#include <snes.h>#include <snes/console.h>#include <snes/video.h>#include <snes/background.h>#include <snes/colormath.h>Functions | |
| void | loadGraphics (void) |
| Assembly DMA loader for SUPERFREE graphics data. | |
| int | main (void) |
| Entry point: color math transparency with scrolling clouds over a landscape. | |
Color addition transparency between two background layers.
Demonstrates the SNES color math unit by blending two background layers. BG1 (main screen) shows a 4bpp landscape, while BG3 (sub screen) holds 2bpp semi-transparent clouds that scroll horizontally. The PPU adds the sub screen pixel colors to the main screen via registers CGWSEL ($2130) and CGADSUB ($2131), producing a translucent overlay effect.
Mode 1 is used with BG3 priority high so the 2bpp cloud layer renders above BG1. Color addition is applied to BG1 and the backdrop, meaning the cloud colors are numerically added to whatever is underneath.
Based on PVSnesLib Transparency example by Alekmaul.
|
extern |
Assembly DMA loader for SUPERFREE graphics data.
Handles DMA transfers with correct bank bytes for tile/tilemap/palette data that may be placed in ROM banks beyond $00 by the linker. C code cannot reliably specify bank bytes for SUPERFREE sections, so an assembly routine uses the :label syntax to get the linker-resolved bank at link time.
Defined in data.asm. Loads BG1 (4bpp landscape) and BG3 (2bpp clouds) tile data, tilemaps, and palettes to their respective VRAM/CGRAM addresses.
| int main | ( | void | ) |
Entry point: color math transparency with scrolling clouds over a landscape.
Sets up Mode 1 with two background layers:
The SNES color math unit adds the sub screen pixel colors to the main screen, producing a translucent cloud overlay. BG3 is given priority high so its tiles render above BG1 in Mode 1's layer ordering.
Horizontal scroll offset for the cloud layer (BG3), incremented each frame