PAlib
Macros
Special Effects

Macros

#define PA_EnableBgMosaic(screen, bg)   _REG16(REG_BGCNT(screen, bg)) |= (1 << 6)
 Enable the mosaic effect for a given background.
 
#define PA_DisableBgMosaic(screen, bg)   _REG16(REG_BGCNT(screen, bg)) &= ~(1 << 6)
 Disable the mosaic effect for a given background.
 
#define PA_SetBgMosaicXY(screen, h_size, v_size)   do{PA_REG_MOSAIC(screen) &= 255; PA_REG_MOSAIC(screen) |= ((h_size) + ((v_size) << 4));}while(0)
 Set the Mosaic parameters for the backgrounds.
 
#define PA_SetSpriteMosaicXY(screen, h_size, v_size)   do{PA_REG_MOSAIC(screen) &= (255 << 8); PA_REG_MOSAIC(screen) |= (((h_size) << 8) + ((v_size) << 12));}while(0)
 Set the Mosaic parameters for the sprites.
 
#define PA_EnableSpecialFx(screen, EffectType, FirstTarget, SecondTarget)   PA_REG_BLDCNT(screen) = ((FirstTarget) + ((SecondTarget) << 8) + ((EffectType) << 6))
 Enable Special Effects and set whether backgrounds and sprites will use them or not. This also sets the type of Effect.
 
#define PA_DisableSpecialFx(screen)   PA_REG_BLDCNT(screen) = 0
 Disable Special Effects.
 
#define PA_SetSFXAlpha(screen, Coeff1, Coeff2)   PA_REG_BLDALPHA(screen) = (Coeff1) + ((Coeff2) << 8)
 Set the special effect parameters for Alpha-Blending.
 

Detailed Description

Set the sprite special effects (alpha-blending, luminosity, mosaic effects...)

Macro Definition Documentation

◆ PA_EnableBgMosaic

#define PA_EnableBgMosaic (   screen,
  bg 
)    _REG16(REG_BGCNT(screen, bg)) |= (1 << 6)

Enable the mosaic effect for a given background.

Parameters
screenBackground screen (0 or 1)
bgBackground number

◆ PA_DisableBgMosaic

#define PA_DisableBgMosaic (   screen,
  bg 
)    _REG16(REG_BGCNT(screen, bg)) &= ~(1 << 6)

Disable the mosaic effect for a given background.

Parameters
screenBackground screen (0 or 1)
bgBackground number

◆ PA_SetBgMosaicXY

#define PA_SetBgMosaicXY (   screen,
  h_size,
  v_size 
)    do{PA_REG_MOSAIC(screen) &= 255; PA_REG_MOSAIC(screen) |= ((h_size) + ((v_size) << 4));}while(0)

Set the Mosaic parameters for the backgrounds.

Parameters
screenScreen...
h_sizeHorizontal size of the mosaic (1 for 1 pixel, 2 for 2 pixels, etc...)
v_sizeVertical size of the mosaic (1 for 1 pixel, 2 for 2 pixels, etc...)

◆ PA_SetSpriteMosaicXY

#define PA_SetSpriteMosaicXY (   screen,
  h_size,
  v_size 
)    do{PA_REG_MOSAIC(screen) &= (255 << 8); PA_REG_MOSAIC(screen) |= (((h_size) << 8) + ((v_size) << 12));}while(0)

Set the Mosaic parameters for the sprites.

Parameters
screenScreen...
h_sizeHorizontal size of the mosaic (1 for 1 pixel, 2 for 2 pixels, etc...)
v_sizeVertical size of the mosaic (1 for 1 pixel, 2 for 2 pixels, etc...)

◆ PA_EnableSpecialFx

#define PA_EnableSpecialFx (   screen,
  EffectType,
  FirstTarget,
  SecondTarget 
)    PA_REG_BLDCNT(screen) = ((FirstTarget) + ((SecondTarget) << 8) + ((EffectType) << 6))

Enable Special Effects and set whether backgrounds and sprites will use them or not. This also sets the type of Effect.

Parameters
screenScreen...
EffectTypeEffect Type. 0 for non, 1 for alpha-blending, 2 for brightness increase, and 3 for brightness decrease. You can use the macros SFX_NONE, SFX_ALPHA, SFX_BRIGHTINC, SFX_BRIGHTDEC
FirstTargetBackgrounds and sprites for which to activate the effect. Use the following macro : SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD (back drop)
SecondTargetBackgrounds and sprites to be seen behind the alpha-blending. Use the following macro : SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD (back drop)

◆ PA_DisableSpecialFx

#define PA_DisableSpecialFx (   screen)    PA_REG_BLDCNT(screen) = 0

Disable Special Effects.

Parameters
screenScreen...

◆ PA_SetSFXAlpha

#define PA_SetSFXAlpha (   screen,
  Coeff1,
  Coeff2 
)    PA_REG_BLDALPHA(screen) = (Coeff1) + ((Coeff2) << 8)

Set the special effect parameters for Alpha-Blending.

Parameters
screenScreen...
Coeff1Coefficient for the first layer, from 0 to 31. Apparently, it's better to set between 0 and 16
Coeff2Coefficient for the second layer, from 0 to 31. Apparently, it's better to set between 0 and 16