source/src/graphics.c
//simple fade function for DMG gameboy (to BLACK) need to set fadecounter first using above function
simple fade function for DMG gameboy (to BLACK) need to set fadecounter first using above function
simple fade function for DMG gameboy ( to BLACK ) need to set fadecounter first using above function
uint8_t fadegb()
{
    #ifdef NINTENDO
    if (fadeCounter == 0)
    {
        return 1;
    }
    else
    {
        if(fadeCounter == startFade)
        {
            if (fadein)
            {
                BGP_REG = DMG_PALETTE(DMG_BLACK, DMG_BLACK, DMG_BLACK, DMG_BLACK);
            }
            else
            {    
                BGP_REG = DMG_PALETTE(DMG_WHITE, DMG_LITE_GRAY, DMG_DARK_GRAY, DMG_BLACK);
            }
        }
        else
        {
            if(fadeCounter == startFade-fadeStep)
            {
                if (fadein)
                {
                    BGP_REG =  DMG_PALETTE(DMG_DARK_GRAY, DMG_DARK_GRAY, DMG_DARK_GRAY, DMG_BLACK);
                }
                else
                {
                    BGP_REG =  DMG_PALETTE(DMG_LITE_GRAY, DMG_DARK_GRAY, DMG_BLACK, DMG_BLACK);
                }
            }
            else
            {
                if (fadeCounter == startFade-fadeStep-fadeStep)
                {
                    if (fadein)
                    {
                        BGP_REG = DMG_PALETTE(DMG_LITE_GRAY, DMG_LITE_GRAY, DMG_DARK_GRAY, DMG_BLACK);
                    }
                    else
                    {    
                        BGP_REG =  DMG_PALETTE(DMG_DARK_GRAY, DMG_BLACK, DMG_BLACK, DMG_BLACK);
                    }
                }
                else
                {
                    if(fadeCounter == startFade-fadeStep-fadeStep-fadeStep)
                    {
                        if (fadein)
                        {
                            BGP_REG = DMG_PALETTE(DMG_WHITE, DMG_LITE_GRAY, DMG_DARK_GRAY, DMG_BLACK);
                        }
                        else
                        {    
                            BGP_REG =  DMG_PALETTE(DMG_BLACK, DMG_BLACK, DMG_BLACK, DMG_BLACK);
                        }
                    }
                }
            }
        }
    }
    fadeCounter--;
    return 0;
    #endif
    #ifdef SEGA
    return 1;
    #endif
}
uint8_t fadegb ( ) { #ifdef NINTENDO if ( fadeCounter == 0 ) { return 1 ; } else { if ( fadeCounter == startFade ) { if ( fadein ) { BGP_REG = DMG_PALETTE ( DMG_BLACK , DMG_BLACK , DMG_BLACK , DMG_BLACK ) ; } else { BGP_REG = DMG_PALETTE ( DMG_WHITE , DMG_LITE_GRAY , DMG_DARK_GRAY , DMG_BLACK ) ; } } else { if ( fadeCounter == startFade - fadeStep ) { if ( fadein ) { BGP_REG = DMG_PALETTE ( DMG_DARK_GRAY , DMG_DARK_GRAY , DMG_DARK_GRAY , DMG_BLACK ) ; } else { BGP_REG = DMG_PALETTE ( DMG_LITE_GRAY , DMG_DARK_GRAY , DMG_BLACK , DMG_BLACK ) ; } } else { if ( fadeCounter == startFade - fadeStep - fadeStep ) { if ( fadein ) { BGP_REG = DMG_PALETTE ( DMG_LITE_GRAY , DMG_LITE_GRAY , DMG_DARK_GRAY , DMG_BLACK ) ; } else { BGP_REG = DMG_PALETTE ( DMG_DARK_GRAY , DMG_BLACK , DMG_BLACK , DMG_BLACK ) ; } } else { if ( fadeCounter == startFade - fadeStep - fadeStep - fadeStep ) { if ( fadein ) { BGP_REG = DMG_PALETTE ( DMG_WHITE , DMG_LITE_GRAY , DMG_DARK_GRAY , DMG_BLACK ) ; } else { BGP_REG = DMG_PALETTE ( DMG_BLACK , DMG_BLACK , DMG_BLACK , DMG_BLACK ) ; } } } } } } fadeCounter -- ; return 0 ; #endif #ifdef SEGA return 1 ; #endif }
simple fade function for DMG gameboy (to BLACK) need to set fadecounter first using above function
simple fade function for DMG gameboy ( to BLACK ) need to set fadecounter first using above function