-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtitle.cpp
50 lines (41 loc) · 1 KB
/
title.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
//
// Created by Allen on 5/5/2020.
//
#include "title.h"
#include "UART.h"
#include "metadata.h"
#include "colors_title.h"
void Title::start() {
reset();
animator_setBackgroundColors(colors_title);
animator_readPersistentSprite(persistentSprites[BACKGROUND_TITLESCREEN], 0, 0);
animator_readCharacterSDCard(4);
}
void Title::loop(bool buttonPressed, void (*transitionCall)(void)) {
if(buttonPressed) {
(*transitionCall)();
return;
}
int8_t frameExtension = 10;
if(frameLengthCounter++ >= frameExtension) {
frameIndex++;
frameLengthCounter = 0;
}
frameIndex %= 2;
SpriteSendable s;
s.charIndex = charIndex;
s.framePeriod = 1;
s.animationIndex = 6;
s.frame = frameIndex;
s.persistent = false;
s.continuous = false;
s.mirrored = false;
s.x = TITLE_MESSAGE_X;
s.y = TITLE_MESSAGE_Y;
UART_sendAnimation(s);
UART_commandUpdate();
}
void Title::reset() {
frameIndex = 0;
frameLengthCounter = 0;
}