Skip to content

Commit

Permalink
DSi theme: Add icon drop down effect during fade-in
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Jul 17, 2018
1 parent 7a7211c commit 6354154
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 8 deletions.
36 changes: 29 additions & 7 deletions romsel_dsimenutheme/arm9/source/fileBrowse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ extern bool arm7SCFGLocked;
extern int consoleModel;
extern bool isRegularDS;

extern bool dropDown;
extern bool redoDropDown;
extern bool showbubble;
extern bool showSTARTborder;

Expand Down Expand Up @@ -386,6 +388,15 @@ bool isTopLevel(const char *path)
#endif
}

void waitForFadeOut (void) {
if (!dropDown && theme == 0) {
dropDown = true;
for (int i = 0; i < 60; i++) swiWaitForVBlank();
} else {
for (int i = 0; i < 25; i++) swiWaitForVBlank();
}
}

string browseForFile(const vector<string> extensionList, const char* username)
{
int pressed = 0;
Expand Down Expand Up @@ -471,14 +482,15 @@ string browseForFile(const vector<string> extensionList, const char* username)
}
}

whiteScreen = false;
fadeType = true; // Fade in from white
for (int i = 0; i < 5; i++) swiWaitForVBlank();
if (!music) {
mmEffectEx(&mus_menu);
music = true;
}
whiteScreen = false;
fadeType = true; // Fade in from white
for (int i = 0; i < 30; i++) swiWaitForVBlank();

waitForFadeOut();

/* clearText(false);
updatePath();
TextPane *pane = &createTextPane(20, 3 + ENTRIES_START_ROW*FONT_SY, ENTRIES_PER_SCREEN);
Expand Down Expand Up @@ -711,6 +723,7 @@ string browseForFile(const vector<string> extensionList, const char* username)
whiteScreen = true;
if (showBoxArt) clearBoxArt(); // Clear box art
boxArtLoaded = false;
redoDropDown = true;
shouldersRendered = false;
showbubble = false;
showSTARTborder = false;
Expand Down Expand Up @@ -881,6 +894,7 @@ string browseForFile(const vector<string> extensionList, const char* username)
whiteScreen = true;
if (showBoxArt) clearBoxArt(); // Clear box art
boxArtLoaded = false;
redoDropDown = true;
shouldersRendered = false;
showbubble = false;
showSTARTborder = false;
Expand All @@ -900,6 +914,7 @@ string browseForFile(const vector<string> extensionList, const char* username)
whiteScreen = true;
if (showBoxArt) clearBoxArt(); // Clear box art
boxArtLoaded = false;
redoDropDown = true;
shouldersRendered = false;
showbubble = false;
showSTARTborder = false;
Expand Down Expand Up @@ -937,12 +952,16 @@ string browseForFile(const vector<string> extensionList, const char* username)
SaveSettings();
settingsChanged = false;
}
shouldersRendered = false;
whiteScreen = true;
redoDropDown = true;
shouldersRendered = false;
showbubble = false;
showSTARTborder = false;
clearText();
whiteScreen = false;
fadeType = true; // Fade in from white
for (int i = 0; i < 30; i++) swiWaitForVBlank();
for (int i = 0; i < 5; i++) swiWaitForVBlank();
waitForFadeOut();
} else if (showDirectories) {
// Go up a directory
mmEffectEx(&snd_select);
Expand All @@ -955,6 +974,7 @@ string browseForFile(const vector<string> extensionList, const char* username)
whiteScreen = true;
if (showBoxArt) clearBoxArt(); // Clear box art
boxArtLoaded = false;
redoDropDown = true;
shouldersRendered = false;
showbubble = false;
showSTARTborder = false;
Expand Down Expand Up @@ -1049,13 +1069,15 @@ string browseForFile(const vector<string> extensionList, const char* username)
whiteScreen = true;
if (showBoxArt) clearBoxArt(); // Clear box art
boxArtLoaded = false;
redoDropDown = true;
shouldersRendered = false;
showbubble = false;
showSTARTborder = false;
clearText();
whiteScreen = false;
fadeType = true; // Fade in from white
for (int i = 0; i < 30; i++) swiWaitForVBlank();
for (int i = 0; i < 5; i++) swiWaitForVBlank();
waitForFadeOut();
}

if ((pressed & KEY_SELECT) && !startMenu
Expand Down
52 changes: 51 additions & 1 deletion romsel_dsimenutheme/arm9/source/graphics/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ extern int colorRvalue;
extern int colorGvalue;
extern int colorBvalue;

extern bool dropDown;
extern bool redoDropDown;
int dropTime = 0;
int dropSeq = 0;
int dropSpeed = 5;
int dropSpeedChange = 0;
extern bool showbubble;
extern bool showSTARTborder;

Expand Down Expand Up @@ -112,7 +118,7 @@ extern int startMenu_cursorPosition;
extern int pagenum;
int titleboxXpos;
int startMenu_titleboxXpos;
int titleboxYpos = 85;
int titleboxYpos = -80; // 85, when dropped down
int titlewindowXpos;
int startMenu_titlewindowXpos;

Expand Down Expand Up @@ -505,6 +511,50 @@ void vBlankHandler()
}
}

if (redoDropDown && theme == 0) {
dropTime = 0;
dropSeq = 0;
dropSpeed = 5;
dropSpeedChange = 0;
titleboxYpos = -80; // 85, when dropped down
dropDown = false;
redoDropDown = false;
}

if (dropDown && theme == 0) {
if (dropSeq == 0) {
titleboxYpos += dropSpeed;
if (titleboxYpos > 85) dropSeq = 1;
} else if (dropSeq == 1) {
titleboxYpos -= dropSpeed;
dropTime++;
dropSpeedChange++;
if (dropTime >= 15) {
dropSpeedChange = -1;
dropSeq = 2;
}
if (dropSpeedChange == 2) {
dropSpeed--;
if (dropSpeed < 0) dropSpeed = 0;
dropSpeedChange = -1;
}
} else if (dropSeq == 2) {
titleboxYpos += dropSpeed;
if (titleboxYpos >= 85) {
dropSeq = 3;
titleboxYpos = 85;
}
dropSpeedChange++;
if (dropSpeedChange == 1) {
dropSpeed++;
if (dropSpeed > 4) dropSpeed = 4;
dropSpeedChange = -1;
}
} else if (dropSeq == 3) {
titleboxYpos = 85;
}
}

//if (renderingTop)
//{
/*glBoxFilledGradient(0, -64, 256, 112,
Expand Down
2 changes: 2 additions & 0 deletions romsel_dsimenutheme/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ bool useBootstrap = false;

using namespace std;

bool dropDown = false;
bool redoDropDown = false;
bool showbubble = false;
bool showSTARTborder = false;

Expand Down

0 comments on commit 6354154

Please sign in to comment.