-
Notifications
You must be signed in to change notification settings - Fork 12
/
ardynia.ino
50 lines (38 loc) · 816 Bytes
/
ardynia.ino
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
#include <EEPROM.h>
#include <Arduboy2.h>
#include <ArduboyPlaytune.h>
#include <math.h>
#include "src/game.h"
#include "src/renderer.h"
#include "src/util.h"
#include "src/sfx.h"
#include "src/tileBitmaps.h"
Arduboy2Base arduboy;
ArduboyPlaytune tones(arduboy.audio.enabled);
Renderer renderer(arduboy);
Game game;
void setup() {
arduboy.boot();
arduboy.audio.begin();
Sfx::init(&tones);
#ifdef SERIAL_LOG
Serial.begin(9600);
delay(1500);
LOG("setup done");
#endif
}
uint8_t loopCounter = 1;
void loop() {
if (!arduboy.nextFrame()) {
return;
}
loopCounter += 1;
if (loopCounter == 61) {
loopCounter = 1;
}
arduboy.clear();
arduboy.pollButtons();
game.update(loopCounter);
game.render(loopCounter);
arduboy.display();
}