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>#include "res/backgrounds.inc"#include "res/clouds.inc"Functions | |
| int | main (void) |
| Assembly DMA loader for SUPERFREE graphics data. | |
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.
| int main | ( | void | ) |
Assembly DMA loader for SUPERFREE graphics data.
Asset symbols from data.asm (.incbin sections). Post-A6+A7 (v0.19.0) C pointers carry the bank byte, so dmaCopyVram / dmaCopyCGram resolve the correct source bank automatically — no ASM stub needed.
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