(c):void fadeOut(u8 screen){ s8 i = 0; for(i = 0; i >= -8; i--) { PA_WaitForVBL(); if(screen == 0 || screen == 2) { PA_SetBrightness(0, i); } if(screen == 1 || screen == 2) { PA_SetBrightness(1, i); } }} void fadeIn(u8 screen){ s8 i = 0; for(i = -8; i <= 0; i++) { PA_WaitForVBL(); if(screen == 0 || screen == 2) { PA_SetBrightness(0, i); } if(screen == 1 || screen == 2) { PA_SetBrightness(1, i); } }}
(c):// This time around, we'll scroll a background... // Includes#include <PA9.h> // Include for PA_Lib // Converted using PAGfxConverter#include "gfx/all_gfx.c"#include "gfx/all_gfx.h" void fadeOut(u8 screen){ s8 i = 0; for(i = 0; i >= -8; i--) { PA_WaitForVBL(); if(screen == 0 || screen == 2) { PA_SetBrightness(0, i); } if(screen == 1 || screen == 2) { PA_SetBrightness(1, i); } }} void fadeIn(u8 screen){ s8 i = 0; for(i = -8; i <= 0; i++) { PA_WaitForVBL(); if(screen == 0 || screen == 2) { PA_SetBrightness(0, i); } if(screen == 1 || screen == 2) { PA_SetBrightness(1, i); } }} // Function: main()int main(int argc, char ** argv){ PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL // Load the dual background... PA_EasyBgLoad(0,3, //bg number generique1); //background name PA_EasyBgLoad(1,3, //bg number generique2); //background name // Infinite loop to keep the program running while (1) { fadeOut(0); fadeIn(0); PA_WaitForVBL(); } return 0;} // End of main()
(c):void fadeToWhite(u8 screen){ for(s8 i = 0; i <=31; i++) { if(screen == 0 || screen == 2) { PA_SetBrightness(0, i); } if(screen == 1 || screen == 2) { PA_SetBrightness(1, i); } PA_WaitForVBL(); }} void fadeFromWhite(u8 screen){ for(s8 i = 31; i >= 0; i--) { if(screen == 0 || screen == 2) { PA_SetBrightness(0, i); } if(screen == 1 || screen == 2) { PA_SetBrightness(1, i); } PA_WaitForVBL(); }}
(c):// This is basicly an example using the brightness to fade in/out... // Includes#include <PA9.h> // Include for PA_Lib #include "test.h"s16 level = 0;s16 fade;u8 black = 0; void HBL_function(void){ s16 vcount = PA_GetVcount(); vcount++; if(vcount > 192) vcount = 0; // Get correct vcount fade = (vcount+(level*4)-192)>>2; if(fade < 0) fade = 0; if(fade > 31) fade = 31; if(black) PA_SetBrightness(0, fade-31); else PA_SetBrightness(0, 31-fade);} // Function: main()int main(int argc, char ** argv){ PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL PA_InitText(1, 0); PA_SetBrightness(0, 31); PA_Init8bitBg(0, 3); PA_LoadGif(0, (void*)test); irqSet(IRQ_HBLANK, HBL_function); irqEnable(IRQ_HBLANK); u8 i; level = 0; while(1){ PA_OutputText(1, 8, 10, "Fading in, white "); for(level = 0; level < 80; level++) PA_WaitForVBL(); for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second black = 1; PA_OutputText(1, 8, 10, "Fading out, black "); for(level = 80; level > 0; level--) PA_WaitForVBL(); for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second PA_OutputText(1, 8, 10, "Fading in, black "); for(level = 0; level < 80; level++) PA_WaitForVBL(); for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second black = 0; PA_OutputText(1, 8, 10, "Fading out, white "); for(level = 80; level > 0; level--) PA_WaitForVBL(); for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second } return 0;} // End of main()
(c):PA_SetBrightness(1, 31);
(c):PA_SetBrightness(0, 31);
(c):// This time around, we'll scroll a background... // Includes#include <PA9.h> // Include for PA_Lib // Converted using PAGfxConverter#include "gfx/all_gfx.c"#include "gfx/all_gfx.h" s16 level = 0;s16 fade;u8 black = 0; void HBL_function1(void){ s16 vcount = PA_GetVcount(); vcount++; if(vcount > 192) vcount = 0; // Get correct vcount fade = (vcount+(level*4)-192)>>2; if(fade < 0) fade = 0; if(fade > 31) fade = 31; if(black) PA_SetBrightness(0, fade-31); else PA_SetBrightness(0, 31-fade);} void HBL_function2(void){ s16 vcount = PA_GetVcount(); vcount++; if(vcount > 192) vcount = 0; // Get correct vcount fade = (vcount+(level*4)-192)>>2; if(fade < 0) fade = 0; if(fade > 31) fade = 31; if(black) PA_SetBrightness(1, fade-31); else PA_SetBrightness(1, 31-fade);} // Function: main()int main(int argc, char ** argv){ PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL // Load the dual background... PA_EasyBgLoad(0,3, //bg number generique1); //background name PA_EasyBgLoad(1,3, //bg number generique2); //background name u8 i; level = 0; while(1){ irqSet(IRQ_HBLANK, HBL_function1); irqEnable(IRQ_HBLANK); for(level = 0; level < 80; level++) PA_WaitForVBL(); for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second for(level = 0; level < 80; level++) PA_WaitForVBL(); for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second irqSet(IRQ_HBLANK, HBL_function2); irqEnable(IRQ_HBLANK); for(level = 0; level < 80; level++) PA_WaitForVBL(); for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second for(level = 0; level < 80; level++) PA_WaitForVBL(); for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second } return 0;} // End of main()
(c):if(black) PA_SetBrightness(1, fade-31); else PA_SetBrightness(1, 31-fade);
(c):if(black) PA_SetBrightness(0, fade-31); else PA_SetBrightness(0, 31-fade);