Skip to content

Commit 8bc8b21

Browse files
committed
Splashscreen will now change background to black and then return it once it has finished
1 parent 873e8eb commit 8bc8b21

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

source/spritetools_splash.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <3ds.h>
88
#include <spritetools_splash.h>
9+
#include <spritetools_time.h>
910

1011
/*****************\
1112
|* Image *|
@@ -19077,21 +19078,22 @@ static const struct {
1907719078
/* Takes time to display in ms */
1907819079
void ST_Splashscreen(u64 time)
1907919080
{
19080-
u64 startTime = osGetTime();
19081-
u64 currentTime = startTime;
1908219081
u8 fade = 0;
19082+
u32 bg = ST_RenderGetBackground();
1908319083

1908419084
st_spritesheet *splash_s =
1908519085
ST_SpritesheetCreateSpritesheet(splash.pixel_data,
1908619086
splash.width, splash.height);
1908719087

19088+
ST_RenderSetBackground(0x00, 0x00, 0x00);
19089+
1908819090
/* Splash for 4 seconds */
19089-
while ((currentTime = osGetTime() - startTime) <= time)
19091+
while (ST_TimeRunning() <= time)
1909019092
{
19091-
if (currentTime <= 255)
19092-
fade = currentTime; /* Fade in */
19093-
else if (time - currentTime <= 255)
19094-
fade = time - currentTime; /* Fade out */
19093+
if (ST_TimeRunning() <= 255)
19094+
fade = ST_TimeRunning(); /* Fade in */
19095+
else if (time - ST_TimeRunning() <= 255)
19096+
fade = time - ST_TimeRunning(); /* Fade out */
1909519097
else
1909619098
fade = 255; /* Mid splash */
1909719099

@@ -19107,4 +19109,7 @@ void ST_Splashscreen(u64 time)
1910719109

1910819110
/* Free splashscreen */
1910919111
ST_SpritesheetFreeSpritesheet(splash_s);
19112+
19113+
/* Return original background */
19114+
ST_RenderSetBackground(RGBA8_GET_R(bg), RGBA8_GET_G(bg), RGBA8_GET_B(bg));
1911019115
}

0 commit comments

Comments
 (0)