PVSnesLib  4.3.0
Documentation to code in C or ASM for the Nintendo SNES
graphics/Effects/Fading/Fading.c
/*---------------------------------------------------------------------------------
Fading effect demon
-- alekmaul
---------------------------------------------------------------------------------*/
#include <snes.h>
extern char patterns, patterns_end;
extern char palette, palette_end;
extern char map, map_end;
//---------------------------------------------------------------------------------
int main(void)
{
// Initialize console
// Copy tiles to VRAM
bgInitTileSet(0, &patterns, &palette, 0, (&patterns_end - &patterns), (&palette_end - &palette), BG_16COLORS, 0x4000);
// Copy Map to VRAM
bgInitMapSet(0, &map, (&map_end - &map), SC_32x32, 0x1000);
// Now Put in 16 color mode and disable other BGs except 1st one
setMode(BG_MODE1, 0);
// Wait for a key
while (!padsCurrent(0));
// Now just play with effects :P
while (1)
{
// Fade out so light to black
setFadeEffectEx(FADE_OUT,12);
while (!padsCurrent(0));
// Fade in now so black to light
setFadeEffectEx(FADE_IN,24);
while (!padsCurrent(0));
// Fade out so light to black
setFadeEffect(FADE_OUT);
while (!padsCurrent(0));
// Fade in now so black to light
setFadeEffect(FADE_IN);
while (!padsCurrent(0));
}
return 0;
}
void bgSetDisable(u8 bgNumber)
Disable a BG in the actual SNES mode.
void bgInitMapSet(u8 bgNumber, u8 *mapSource, u16 mapSize, u8 sizeMode, u16 address)
Initializes a Map Set and loads it into SNES VRAM.
void bgInitTileSet(u8 bgNumber, u8 *tileSource, u8 *tilePalette, u8 paletteEntry, u16 tileSize, u16 paletteSize, u16 colorMode, u16 address)
Initializes a Tile Set and Loads the Tile GFX into VRAM.
void consoleInit(void)
Initialize console.
#define padsCurrent(value)
Return current value of selected pad.
Definition: input.h:161
void WaitForVBlank(void)
Wait for vblank interrupt
the master include file for snes applications.
void setScreenOn(void)
Put screen On.
void setFadeEffect(u8 mode)
Do a fadein or fadeout effect.
void setFadeEffectEx(u8 mode, u8 framesNumber)
Do a fadein or fadeout effect.
void setMode(u8 mode, u8 size)
Set the SNES hardware to operate in new display mode.