-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathlogoscreen.cpp
95 lines (69 loc) · 1.99 KB
/
logoscreen.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "prism/logoscreen.h"
#include <stdio.h>
#include <prism/animation.h>
#include <prism/screeneffect.h>
#include <prism/timer.h>
#include <prism/input.h>
#include <prism/file.h>
namespace prism {
static struct {
Screen* mNextScreen;
TextureData mBGTexture;
AnimationHandlerElement* mBG;
int mHasSetFadeOutColor;
Color mFadeOutColor;
} gPrismLogoScreenData;
extern char gLogoScreenFileName[100];
static void leaveLogoScreen() {
if (!gPrismLogoScreenData.mNextScreen) abortScreenHandling();
else setNewScreen(gPrismLogoScreenData.mNextScreen);
}
static void endLogoFadeOut(void* tCaller) {
(void)tCaller;
leaveLogoScreen();
}
static void startLogoFadeOut(void* tCaller) {
(void)tCaller;
if (gPrismLogoScreenData.mHasSetFadeOutColor) {
setFadeColor(gPrismLogoScreenData.mFadeOutColor);
}
addFadeOut(20, endLogoFadeOut, NULL);
}
static void logoFadeInOver(void* tCaller) {
(void)tCaller;
addTimerCB(200, startLogoFadeOut, NULL);
}
static void loadWrapperLogoScreen() {
char bgPath[1024];
sprintf(bgPath, "logo/%s.pkg", gLogoScreenFileName);
if (!canLoadTexture(bgPath)) {
leaveLogoScreen();
return;
}
gPrismLogoScreenData.mBGTexture = loadTexture(bgPath);
gPrismLogoScreenData.mBG = playOneFrameAnimationLoop(Vector3D(0, 0, 1), &gPrismLogoScreenData.mBGTexture);
addFadeIn(20, logoFadeInOver, NULL);
}
static Screen* getNextLogoScreenScreen() {
if (hasPressedAbortFlank()) {
abortScreenHandling();
}
if (hasPressedStartFlank()) {
return gPrismLogoScreenData.mNextScreen;
}
return NULL;
}
static Screen gLogoScreen;
Screen* getLogoScreenFromWrapper() {
gLogoScreen = makeScreen(loadWrapperLogoScreen, NULL, NULL, NULL, getNextLogoScreenScreen);
return &gLogoScreen;
}
void setScreenAfterWrapperLogoScreen(Screen* tScreen)
{
gPrismLogoScreenData.mNextScreen = tScreen;
}
void setLogoScreenFadeOutColor(Color tColor) {
gPrismLogoScreenData.mFadeOutColor = tColor;
gPrismLogoScreenData.mHasSetFadeOutColor = 1;
}
}