I'm trying to alpha blend sprites and backgrounds with devkitPro (including libnds, libarm, etc).
Does anyone know how to do this?
As a generic reference, i once wrote a small blog entry about that issue. Basically, you first have to define which layer is alpha-blended against which other layer(s). Afaik,
For the sprites, specifically, you then have 3 ways to achieve alpha-blending depending on what you need and what you're "ready to pay" for it:
BLEND_SRC_SPRITE
in REG_BLDCNT[_SUB]
... not that useful. ATTR0_TYPE_BLENDED
. The blending level will be the same for all sprites (and layers)ATTR2_PALETTE()
field of GBA sprites is useless and has been recycled into ATTR2_ALPHA
. Sprites on the DS can be alpha blended using the blend control registers. TONC gives the necessary information for getting blending working on the main screen because the register locations are the same. Alpha blending on the subscreen uses the same process with different registers at a 1000h offset.
The registers you'll be looking at are REG_BLDMOD
, REG_COLV
, and REG_COLY
for the main screen and REG_BLDMOD_SUB
, REG_COLV_SUB
, and REG_COLY_SUB
for the sub screen.
Also remember that you'll have to change the sprite's graphic mode to enable blending per sprite.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With