Skip to content

Commit

Permalink
Splashscreen will now change background to black and then return it o…
Browse files Browse the repository at this point in the history
…nce it has finished
  • Loading branch information
BtheDestroyer committed Dec 31, 2016
1 parent 873e8eb commit 8bc8b21
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions source/spritetools_splash.c
Expand Up @@ -6,6 +6,7 @@

#include <3ds.h>
#include <spritetools_splash.h>
#include <spritetools_time.h>

/*****************\
|* Image *|
Expand Down Expand Up @@ -19077,21 +19078,22 @@ static const struct {
/* Takes time to display in ms */
void ST_Splashscreen(u64 time)
{
u64 startTime = osGetTime();
u64 currentTime = startTime;
u8 fade = 0;
u32 bg = ST_RenderGetBackground();

st_spritesheet *splash_s =
ST_SpritesheetCreateSpritesheet(splash.pixel_data,
splash.width, splash.height);

ST_RenderSetBackground(0x00, 0x00, 0x00);

/* Splash for 4 seconds */
while ((currentTime = osGetTime() - startTime) <= time)
while (ST_TimeRunning() <= time)
{
if (currentTime <= 255)
fade = currentTime; /* Fade in */
else if (time - currentTime <= 255)
fade = time - currentTime; /* Fade out */
if (ST_TimeRunning() <= 255)
fade = ST_TimeRunning(); /* Fade in */
else if (time - ST_TimeRunning() <= 255)
fade = time - ST_TimeRunning(); /* Fade out */
else
fade = 255; /* Mid splash */

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

/* Free splashscreen */
ST_SpritesheetFreeSpritesheet(splash_s);

/* Return original background */
ST_RenderSetBackground(RGBA8_GET_R(bg), RGBA8_GET_G(bg), RGBA8_GET_B(bg));
}

1 comment on commit 8bc8b21

@BtheDestroyer
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.