-
Notifications
You must be signed in to change notification settings - Fork 0
/
baftascreen.c
65 lines (51 loc) · 1.69 KB
/
baftascreen.c
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
#include "baftascreen.h"
#include <stdio.h>
#include <string.h>
#include <tari/input.h>
#include <tari/animation.h>
#include <tari/tweening.h>
#include <tari/timer.h>
#include <tari/screeneffect.h>
#include "titlescreen.h"
static struct {
TextureData mMirklingsBGTexture;
TextureData mHumanBGTexture;
int mMirklingsBG;
int mHumanBG;
double mHumanTransparency;
} gData;
static void startFadeOver(void* tCaller) {
(void)tCaller;
tweenDouble(&gData.mHumanTransparency, 0, 1, quadraticTweeningFunction, 60, NULL, NULL);
}
static void loadBaftaScreen() {
gData.mMirklingsBGTexture = loadTexture("assets/ending/ENDING_MIRKLINGS.pkg");
gData.mHumanBGTexture = loadTexture("assets/ending/ENDING_HUMAN.pkg");
gData.mMirklingsBG = playAnimationLoop(makePosition(0,0,1), &gData.mMirklingsBGTexture, createOneFrameAnimation(), makeRectangleFromTexture(gData.mMirklingsBGTexture));
gData.mHumanBG = playAnimationLoop(makePosition(0, 0, 2), &gData.mHumanBGTexture, createOneFrameAnimation(), makeRectangleFromTexture(gData.mMirklingsBGTexture));
gData.mHumanTransparency = 0;
setAnimationTransparency(gData.mHumanBG, gData.mHumanTransparency);
addTimerCB(180, startFadeOver, NULL);
addFadeIn(20, NULL, NULL);
}
static void updateBaftaScreen() {
setAnimationTransparency(gData.mHumanBG, gData.mHumanTransparency);
}
static void goToTitle(void* tCaller) {
(void)tCaller;
setNewScreen(&TitleScreen);
}
static Screen* getNextBaftaScreenScreen() {
if (hasPressedAbortFlank()) {
return &TitleScreen;
}
if (hasPressedStartFlank()) {
addFadeOut(20, goToTitle, NULL);
}
return NULL;
}
Screen BaftaScreen = {
.mLoad = loadBaftaScreen,
.mUpdate = updateBaftaScreen,
.mGetNextScreen = getNextBaftaScreenScreen,
};