Update fading

This commit is contained in:
CTurt 2016-01-09 10:13:14 +00:00
parent a452e6e8d0
commit 4e57cf65f9

View File

@ -9,7 +9,7 @@ inline int DSGM_GetBrightness(u8 screen) {
} }
void DSGM_FadeIn(u8 screen, u8 delay) { void DSGM_FadeIn(u8 screen, u8 delay) {
int brightness = DSGM_GetBrightness(DSGM_BOTTOM); int brightness = DSGM_GetBrightness(screen);
if(brightness == -15) { if(brightness == -15) {
// Fade in from black // Fade in from black
while(brightness < 0) { while(brightness < 0) {
@ -29,26 +29,22 @@ void DSGM_FadeIn(u8 screen, u8 delay) {
} }
void DSGM_FadeOutToBlack(u8 screen, u8 delay) { void DSGM_FadeOutToBlack(u8 screen, u8 delay) {
int brightness = DSGM_GetBrightness(DSGM_BOTTOM); int brightness = DSGM_GetBrightness(screen);
if(brightness == 0) {
while(brightness > -15) { while(brightness > -15) {
brightness -= 1; brightness -= 1;
DSGM_SetBrightness(screen, brightness); DSGM_SetBrightness(screen, brightness);
int i; for(i = 0; i < delay; i++) swiWaitForVBlank(); int i; for(i = 0; i < delay; i++) swiWaitForVBlank();
} }
} }
}
void DSGM_FadeOutToWhite(u8 screen, u8 delay) { void DSGM_FadeOutToWhite(u8 screen, u8 delay) {
int brightness = DSGM_GetBrightness(DSGM_BOTTOM); int brightness = DSGM_GetBrightness(screen);
if(brightness == 0) {
while(brightness < 15) { while(brightness < 15) {
brightness += 1; brightness += 1;
DSGM_SetBrightness(screen, brightness); DSGM_SetBrightness(screen, brightness);
int i; for(i = 0; i < delay; i++) swiWaitForVBlank(); int i; for(i = 0; i < delay; i++) swiWaitForVBlank();
} }
} }
}
inline u64 DSGM_SquareDistance(s32 x1, s32 y1, s32 x2, s32 y2) { inline u64 DSGM_SquareDistance(s32 x1, s32 y1, s32 x2, s32 y2) {
s64 h = x1 - x2; s64 h = x1 - x2;